예제 #1
0
파일: test_gfx_filters.c 프로젝트: tasn/efl
static void
_spinner_fill(Eo *obj)
{
   const Filter *f;
   size_t k;

   for (k = 0; k < EINA_C_ARRAY_LENGTH(templates); k++)
     {
        f = &templates[k];
        elm_spinner_special_value_add(obj, (double) k, f->name);
     }
   elm_spinner_editable_set(obj, EINA_FALSE);
   elm_spinner_min_max_set(obj, 0, k - 1);
   elm_spinner_wrap_set(obj, 1);
}
예제 #2
0
Evas_Object *
init_panel_camera_light(Evas_Object *win, Eo *camera_node, Eo *light_node, double posX, double posY)
{
   Evas_Object *nnavig = NULL, *bx_navigall = NULL;
   Evas_Object *bx_navigcamup = NULL, *bx_navigcamlow = NULL, *bx_navigligthup = NULL, *bx_navigligthlow = NULL;
   Evas_Object *spX = NULL, *spY = NULL, *spZ = NULL;
   Evas_Object *spangle = NULL, *spaX = NULL, *spaY = NULL, *spaZ = NULL;
   Evas_Object *splX = NULL, *splY = NULL, *splZ = NULL;
   Evas_Object *splangle = NULL, *splaX = NULL, *splaY = NULL, *splaZ = NULL;
   Evas_Object *separator = NULL;
   Axis_Key *camera_xyz = NULL, *light_xyz = NULL;
   Panel_Struct *pobject = NULL;
   Evas_Real px = 0, py = 0, pz = 0;

   if (ELM_WIN_UNKNOWN == elm_win_type_get(win))
     {
        fprintf(stdout, "Not appropriate parent object - at %s line %d\n", __FILE__, __LINE__);
        return NULL;
     }

   if (!_alloc_memory(&camera_xyz, &pobject, &light_xyz)) return NULL;

   /*Navigation panel layout*/
   bx_navigall = elm_box_add(win);
   elm_box_homogeneous_set(bx_navigall, EINA_TRUE);
   evas_object_show(bx_navigall);

   bx_navigcamup = elm_box_add(win);
   elm_box_horizontal_set(bx_navigcamup, EINA_TRUE);
   elm_box_homogeneous_set(bx_navigcamup, EINA_TRUE);
   elm_box_pack_end(bx_navigall, bx_navigcamup);
   evas_object_show(bx_navigcamup);
   bx_navigcamlow = elm_box_add(win);
   elm_box_horizontal_set(bx_navigcamlow, EINA_TRUE);
   elm_box_homogeneous_set(bx_navigcamlow, EINA_TRUE);
   elm_box_pack_end(bx_navigall, bx_navigcamlow);
   evas_object_show(bx_navigcamlow);

   separator = elm_separator_add(win);
   elm_separator_horizontal_set(separator, EINA_TRUE);
   elm_box_pack_end(bx_navigall, separator);
   evas_object_show(separator);

   bx_navigligthup = elm_box_add(win);
   elm_box_horizontal_set(bx_navigligthup, EINA_TRUE);
   elm_box_homogeneous_set(bx_navigligthup, EINA_TRUE);
   elm_box_pack_end(bx_navigall, bx_navigligthup);
   evas_object_show(bx_navigligthup);
   bx_navigligthlow = elm_box_add(win);
   elm_box_horizontal_set(bx_navigligthlow, EINA_TRUE);
   elm_box_homogeneous_set(bx_navigligthlow, EINA_TRUE);
   elm_box_pack_end(bx_navigall, bx_navigligthlow);
   evas_object_show(bx_navigligthlow);

   /*Set UI panel for changing camera and light*/
   /*Init sp camera by default*/
   spX = elm_spinner_add(win);
   elm_spinner_editable_set(spX, EINA_TRUE);
   elm_spinner_min_max_set(spX, -COORDRANGE, COORDRANGE);
   elm_spinner_label_format_set(spX, "camera X: %1.0f");
   elm_spinner_step_set(spX, 1.0);
   pobject->cspX = spX;
   elm_box_pack_end(bx_navigcamup, spX);
   evas_object_show(spX);
   evas_object_smart_callback_add(spX, "changed", _camera_light_changeX_cb, camera_node);

   spY = elm_spinner_add(win);
   elm_spinner_editable_set(spY, EINA_TRUE);
   elm_spinner_min_max_set(spY, -COORDRANGE, COORDRANGE);
   elm_spinner_label_format_set(spY, "camera Y: %1.0f");
   elm_spinner_step_set(spY, 1.0);
   pobject->cspY = spY;
   elm_box_pack_end(bx_navigcamup, spY);
   evas_object_show(spY);
   evas_object_smart_callback_add(spY, "changed", _camera_light_changeY_cb, camera_node);

   spZ = elm_spinner_add(win);
   elm_spinner_editable_set(spZ, EINA_TRUE);
   elm_spinner_min_max_set(spZ, -COORDRANGE, COORDRANGE);
   elm_spinner_label_format_set(spZ, "camera Z: %1.0f");
   elm_spinner_step_set(spY, 1.0);
   pobject->cspZ = spZ;
   elm_box_pack_end(bx_navigcamup, spZ);
   evas_object_show(spZ);
   evas_object_smart_callback_add(spZ, "changed", _camera_light_changeZ_cb, camera_node);

   eo_do(camera_node, evas_canvas3d_node_position_get(EVAS_CANVAS3D_SPACE_PARENT, &px, &py, &pz));
   elm_spinner_value_set(spX, px);
   elm_spinner_value_set(spY, py);
   elm_spinner_value_set(spZ, pz);

   spangle = elm_spinner_add(win);
   elm_spinner_editable_set(spangle, EINA_TRUE);
   elm_spinner_min_max_set(spangle, 0.0, ANGLERANGE);
   elm_spinner_label_format_set(spangle, "angle: %1.0f");
   elm_spinner_step_set(spangle, 1.0);
   pobject->cspangle = spangle;
   evas_object_data_set(spangle, axiskeys, camera_xyz);
   elm_box_pack_end(bx_navigcamlow, spangle);
   elm_spinner_value_set(spangle, 0.0);
   evas_object_show(spangle);
   evas_object_smart_callback_add(spangle, "changed", _camera_light_angle_change_cb, camera_node);

   spaX = elm_spinner_add(win);
   elm_spinner_min_max_set(spaX, 0.0, 1.0);
   elm_spinner_label_format_set(spaX, "axisX: %1.0f");
   elm_spinner_step_set(spaX, 1.0);
   elm_box_pack_end(bx_navigcamlow, spaX);
   evas_object_show(spaX);
   evas_object_smart_callback_add(spaX, "changed", _camera_light_axisX_change_cb, spangle);

   spaY = elm_spinner_add(win);
   elm_spinner_min_max_set(spaY, 0.0, 1.0);
   elm_spinner_label_format_set(spaY, "axisY: %1.0f");
   elm_spinner_step_set(spaY, 1.0);
   elm_box_pack_end(bx_navigcamlow, spaY);
   evas_object_show(spaY);
   evas_object_smart_callback_add(spaY, "changed", _camera_light_axisY_change_cb, spangle);

   spaZ = elm_spinner_add(win);
   elm_spinner_min_max_set(spaZ, 0.0, 1.0);
   elm_spinner_label_format_set(spaZ, "axisZ: %1.0f");
   elm_spinner_step_set(spaZ, 1.0);
   elm_box_pack_end(bx_navigcamlow, spaZ);
   evas_object_show(spaZ);
   evas_object_smart_callback_add(spaZ, "changed", _camera_light_axisZ_change_cb, spangle);

   /*Init spl light by default*/
   splX = elm_spinner_add(win);
   elm_spinner_editable_set(splX, EINA_TRUE);
   elm_spinner_min_max_set(splX, -COORDRANGE, COORDRANGE);
   elm_spinner_label_format_set(splX, "light X: %1.0f");
   elm_spinner_step_set(splX, 1.0);
   pobject->lspX = splX;
   elm_box_pack_end(bx_navigligthup, splX);
   evas_object_show(splX);
   evas_object_smart_callback_add(splX, "changed", _camera_light_changeX_cb, light_node);

   splY = elm_spinner_add(win);
   elm_spinner_editable_set(splY, EINA_TRUE);
   elm_spinner_min_max_set(splY, -COORDRANGE, COORDRANGE);
   elm_spinner_label_format_set(splY, "light Y: %1.0f");
   elm_spinner_step_set(splY, 1.0);
   pobject->lspY = splY;
   elm_box_pack_end(bx_navigligthup, splY);
   evas_object_show(splY);
   evas_object_smart_callback_add(splY, "changed", _camera_light_changeY_cb, light_node);

   splZ = elm_spinner_add(win);
   elm_spinner_editable_set(splZ, EINA_TRUE);
   elm_spinner_min_max_set(splZ, -COORDRANGE, COORDRANGE);
   elm_spinner_label_format_set(splZ, "light Z: %1.0f");
   elm_spinner_step_set(splY, 1.0);
   pobject->lspZ = splZ;
   elm_box_pack_end(bx_navigligthup, splZ);
   evas_object_show(splZ);
   evas_object_smart_callback_add(splZ, "changed", _camera_light_changeZ_cb, light_node);

   eo_do(light_node, evas_canvas3d_node_position_get(EVAS_CANVAS3D_SPACE_PARENT, &px, &py, &pz));
   elm_spinner_value_set(splX, px);
   elm_spinner_value_set(splY, py);
   elm_spinner_value_set(splZ, pz);

   splangle = elm_spinner_add(win);
   elm_spinner_editable_set(splangle, EINA_TRUE);
   elm_spinner_min_max_set(splangle, 0.0, ANGLERANGE);
   elm_spinner_label_format_set(splangle, "angle: %1.0f");
   elm_spinner_step_set(splangle, 1.0);
   pobject->lspangle = splangle;
   evas_object_data_set(splangle, axiskeys, light_xyz);
   elm_box_pack_end(bx_navigligthlow, splangle);
   elm_spinner_value_set(splangle, 0.0);
   evas_object_show(splangle);
   evas_object_smart_callback_add(splangle, "changed", _camera_light_angle_change_cb, light_node);

   splaX = elm_spinner_add(win);
   elm_spinner_min_max_set(splaX, 0.0, 1.0);
   elm_spinner_label_format_set(splaX, "axisX: %1.0f");
   elm_spinner_step_set(splaX, 1.0);
   elm_box_pack_end(bx_navigligthlow, splaX);
   evas_object_show(splaX);
   evas_object_smart_callback_add(splaX, "changed", _camera_light_axisX_change_cb, splangle);

   splaY = elm_spinner_add(win);
   elm_spinner_min_max_set(splaY, 0.0, 1.0);
   elm_spinner_label_format_set(splaY, "axisY: %1.0f");
   elm_spinner_step_set(splaY, 1.0);
   elm_box_pack_end(bx_navigligthlow, splaY);
   evas_object_show(splaY);
   evas_object_smart_callback_add(splaY, "changed", _camera_light_axisY_change_cb, splangle);

   splaZ = elm_spinner_add(win);
   elm_spinner_min_max_set(splaZ, 0.0, 1.0);
   elm_spinner_label_format_set(splaZ, "axisZ: %1.0f");
   elm_spinner_step_set(splaZ, 1.0);
   elm_box_pack_end(bx_navigligthlow, splaZ);
   evas_object_show(splaZ);
   evas_object_smart_callback_add(spaZ, "changed", _camera_light_axisZ_change_cb, splangle);

   nnavig = elm_notify_add(win);
   elm_object_content_set(nnavig, bx_navigall);
   elm_notify_align_set(nnavig, posX, posY);
   evas_object_data_set(nnavig, pb, pobject);

   return nnavig;
}
예제 #3
0
/* externally accessible functions */
Evas_Object *
enna_photo_slideshow_add(Evas_Object *parent)
{
    Smart_Data *sd;
    Evas_Object *bx, *bt, *ic;
    Evas_Coord w, h;

    sd = calloc(1, sizeof(Smart_Data));

    sd->delay = enna_config->slideshow_delay;

    sd->layout = elm_layout_add(parent);
    elm_layout_file_set(sd->layout, enna_config_theme_get(), "enna/slideshow");
    evas_object_size_hint_weight_set(sd->layout, 1.0, 1.0);
    evas_object_show(sd->layout);

    sd->slideshow = elm_slideshow_add(sd->layout);
    elm_slideshow_transition_set(sd->slideshow, "horizontal");
    elm_slideshow_loop_set(sd->slideshow, 1);

//    sd->controls = elm_notify_add(sd->layout);
//    elm_notify_orient_set(sd->controls, ELM_NOTIFY_ORIENT_BOTTOM);
    evas_object_geometry_get(enna->layout, NULL, NULL, &w, &h);
    evas_object_move(sd->controls, 0, 0);
    evas_object_resize(sd->controls, w, h);
    //elm_object_style_set(sd->controls, "enna_bottom");
    /* Fixme : add a config value */
//    elm_notify_timeout_set(sd->controls, 10);

    bx = elm_box_add(sd->layout);
    elm_box_horizontal_set(bx, 1);
//    elm_notify_content_set(sd->controls, bx);
    evas_object_show(bx);

    evas_object_event_callback_add(bx, EVAS_CALLBACK_MOUSE_IN, _mouse_in, sd);
    evas_object_event_callback_add(bx, EVAS_CALLBACK_MOUSE_OUT, _mouse_out, sd);

    ELM_ADD ("icon/mp_prev",    _button_clicked_prev_cb);
    ELM_ADD ("icon/mp_pause",    _button_clicked_play_cb);
    sd->btplay = bt;
    ELM_ADD ("icon/mp_next",    _button_clicked_next_cb);
    ELM_ADD ("icon/mp_stop",    _button_clicked_stop_cb);

    sd->spin = elm_spinner_add(bx);
    elm_spinner_label_format_set(sd->spin, "%2.f secs.");
    evas_object_smart_callback_add(sd->spin, "changed", _spin, sd);
    elm_spinner_step_set(sd->spin, 1);
    elm_spinner_min_max_set(sd->spin, 1, 100);
    elm_spinner_value_set(sd->spin, sd->delay);
    elm_box_pack_end(bx, sd->spin);
    evas_object_show(sd->spin);

#ifdef FEATURE_ROTATION
    ELM_ADD ("icon/rotate_ccw", _button_clicked_rotate_ccw_cb);
    ELM_ADD ("icon/rotate_cw",  _button_clicked_rotate_cw_cb);
#endif /* FEATURE_ROTATION */

    evas_object_show(sd->layout);
    evas_object_show(sd->slideshow);
    elm_layout_content_set(sd->layout, "enna.content.swallow",
                           sd->slideshow);

    evas_object_data_set(sd->layout, "sd", sd);
    sd->state = 4;
    /* Catch mouse wheel event */
    evas_object_event_callback_add(sd->layout, EVAS_CALLBACK_MOUSE_WHEEL,
                                   _mouse_wheel_cb, sd);
    /* connect to the input signal */
    sd->listener = enna_input_listener_add("slideshow", _input_events_cb, sd->layout);
    enna_input_listener_demote(sd->listener);

    evas_object_event_callback_add(sd->layout, EVAS_CALLBACK_MOUSE_UP, _controls_show, sd);
    evas_object_event_callback_add(sd->layout, EVAS_CALLBACK_MOUSE_MOVE, _controls_show, sd);

    evas_object_event_callback_add(sd->layout, EVAS_CALLBACK_DEL,
                                   _sd_del, sd);
    return sd->layout;
}
void ActivityScheduleScenarioView::showTimeSelection(void *data)
{
    int *user_data = reinterpret_cast<int *>(data);

    if (editState == EDIT_START_OFFSET && user_data)
    {
        editStatesHist.push(editState);
        if (*user_data == 0)
        {
            edit_range.start_offset = 0;
            edit_range.shour = "0";
            edit_range.smin = "0";
            edit_range.ssec = "0";

            if (cycle)
            {
                editState = EDIT_END_TYPE;
                createTimeSelectTypeList(NULL, NULL, "", "");

                return;
            }
            else
            {
                editState = EDIT_WEEK;
                showWeekSelection(NULL, NULL, "", "");

                return;
            }
        }
        else if (*user_data == 1)
        {
            edit_range.start_offset = 1;
            editState  = EDIT_START_TIME_OFFSET;
        }
        else if (*user_data == 2)
        {
            edit_range.start_offset = -1;
            editState  = EDIT_START_TIME_OFFSET;
        }
    }

    if (editState == EDIT_END_OFFSET && user_data)
    {
        editStatesHist.push(editState);
        if (*user_data == 0)
        {
            edit_range.end_offset = 0;
            edit_range.ehour = "0";
            edit_range.emin = "0";
            edit_range.esec = "0";

            editState = EDIT_WEEK;
            showWeekSelection(NULL, NULL, "", "");

            return;
        }
        else if (*user_data == 1)
        {
            edit_range.end_offset = 1;
            editState  = EDIT_END_TIME_OFFSET;
        }
        else if (*user_data == 2)
        {
            edit_range.end_offset = -1;
            editState  = EDIT_END_TIME_OFFSET;
        }
    }

    EdjeObject *page = new EdjeObject(ApplicationMain::getTheme(), evas);
    page->LoadEdje("calaos/popup/page/time_schedule");
    page->setAutoDelete(true);

    page->addCallback("button.back", "pressed", sigc::mem_fun(*this, &ActivityScheduleScenarioView::buttonBackClick));

    if (cycle && editState < EDIT_END_TYPE)
        page->addCallback("button.valid", "pressed", sigc::mem_fun(*this, &ActivityScheduleScenarioView::createTimeSelectTypeList));
    else
        page->addCallback("button.valid", "pressed", sigc::mem_fun(*this, &ActivityScheduleScenarioView::showWeekSelection));
    string t;
    if (editState == EDIT_START_TIME)
        t = _("<b>Choose a scheduling</b><br><light_blue><small>Start time of scenario</small></light_blue>");
    else if (editState == EDIT_END_TIME)
        t = _("<b>Choose a scheduling</b><br><light_blue><small>End time of scenario</small></light_blue>");
    else if (editState == EDIT_START_TIME_OFFSET)
        t = _("<b>Choose a time shift</b><br><light_blue><small>Shifting start of scenario</small></light_blue>");
    else if (editState == EDIT_END_TIME_OFFSET)
        t = _("<b>Choose a time shift</b><br><light_blue><small>Shifteng end of scenario</small></light_blue>");
    page->setPartText("text", t);

    int hour_value, min_value, sec_value;
    Evas_Object **spin_hour = NULL, **spin_min = NULL, **spin_sec = NULL;
    if (editState == EDIT_START_TIME || editState == EDIT_START_TIME_OFFSET)
    {
        from_string(edit_range.shour, hour_value);
        from_string(edit_range.smin, min_value);
        from_string(edit_range.ssec, sec_value);

        spin_hour = &spin_start_hours;
        spin_min = &spin_start_min;
        spin_sec = &spin_start_sec;
    }
    else if (editState == EDIT_END_TIME || editState == EDIT_END_TIME_OFFSET)
    {
        from_string(edit_range.ehour, hour_value);
        from_string(edit_range.emin, min_value);
        from_string(edit_range.esec, sec_value);

        spin_hour = &spin_end_hours;
        spin_min = &spin_end_min;
        spin_sec = &spin_end_sec;
    }

    *spin_hour = elm_spinner_add(parent);
    elm_object_style_set(*spin_hour, "calaos/time/vertical");
    elm_spinner_label_format_set(*spin_hour, _("%.0f<br><subtitle>Hours</subtitle>"));
    elm_spinner_min_max_set(*spin_hour, 0, 99);
    elm_spinner_step_set(*spin_hour, 1);
    elm_spinner_interval_set(*spin_hour, 0.15);
    elm_spinner_value_set(*spin_hour, hour_value);
    evas_object_show(*spin_hour);
    page->Swallow(*spin_hour, "spinner.hours", true);

    *spin_min = elm_spinner_add(parent);
    elm_object_style_set(*spin_min, "calaos/time/vertical");
    elm_spinner_label_format_set(*spin_min, _("%.0f<br><subtitle>Min.</subtitle>"));
    elm_spinner_min_max_set(*spin_min, 0, 59);
    elm_spinner_step_set(*spin_min, 1);
    elm_spinner_interval_set(*spin_min, 0.15);
    elm_spinner_value_set(*spin_min, min_value);
    evas_object_show(*spin_min);
    page->Swallow(*spin_min, "spinner.minutes", true);

    *spin_sec = elm_spinner_add(parent);
    elm_object_style_set(*spin_sec, "calaos/time/vertical");
    elm_spinner_label_format_set(*spin_sec, _("%.0f<br><subtitle>Sec.</subtitle>"));
    elm_spinner_min_max_set(*spin_sec, 0, 59);
    elm_spinner_step_set(*spin_sec, 1);
    elm_spinner_interval_set(*spin_sec, 0.15);
    elm_spinner_value_set(*spin_sec, sec_value);
    evas_object_show(*spin_sec);
    page->Swallow(*spin_sec, "spinner.seconds", true);

    evas_object_size_hint_min_set(page->getEvasObject(), 300, 300);
    page->Show();

    elm_naviframe_item_push(pager_popup, NULL, NULL, NULL, page->getEvasObject(), "calaos");
}
예제 #5
0
EAPI_MAIN int
elm_main(int    argc,
         char **argv)
{
   Evas_Object *win, *grid, *bx, *hbx_1, *hbx_2, *hbx_3, *bt, *ck, *sl, *sp;
   Eina_Bool bounce;
   double h, v;

   srand(time(NULL));

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
   elm_app_info_set(elm_main, "elementary", "images");

   win = elm_win_util_standard_add("gengrid", "Generic Grid Example");
   elm_win_autodel_set(win, EINA_TRUE);

   bx = elm_box_add(win);
   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, bx);
   evas_object_show(bx);

   grid = elm_gengrid_add(win);
   elm_gengrid_item_size_set(grid, 150, 150);
   evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_box_pack_end(bx, grid);
   evas_object_smart_callback_add(grid, "clicked,double", _double_click, NULL);
   evas_object_smart_callback_add(grid, "longpressed", _long_pressed, NULL);
   evas_object_show(grid);

   hbx_1 = elm_box_add(win);
   evas_object_size_hint_weight_set(hbx_1, EVAS_HINT_EXPAND, 0.0);
   elm_box_horizontal_set(hbx_1, EINA_TRUE);
   elm_box_pack_end(bx, hbx_1);
   evas_object_show(hbx_1);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "Append");
   evas_object_smart_callback_add(bt, "clicked", _append_bt_clicked, grid);
   elm_box_pack_end(hbx_1, bt);
   evas_object_show(bt);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "Prepend");
   evas_object_smart_callback_add(bt, "clicked", _prepend_bt_clicked, grid);
   elm_box_pack_end(hbx_1, bt);
   evas_object_show(bt);

   before_bt = elm_button_add(win);
   elm_object_text_set(before_bt, "Insert before");
   evas_object_smart_callback_add(before_bt, "clicked", _before_bt_clicked,
                                  grid);
   elm_box_pack_end(hbx_1, before_bt);
   evas_object_show(before_bt);

   after_bt = elm_button_add(win);
   elm_object_text_set(after_bt, "Insert after");
   evas_object_smart_callback_add(after_bt, "clicked", _after_bt_clicked, grid);
   elm_box_pack_end(hbx_1, after_bt);
   evas_object_show(after_bt);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "Clear");
   evas_object_smart_callback_add(bt, "clicked", _clear_cb, grid);
   elm_box_pack_end(hbx_1, bt);
   evas_object_show(bt);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "Bring in 1st");
   evas_object_smart_callback_add(bt, "clicked", _bring_1st_clicked, grid);
   elm_box_pack_end(hbx_1, bt);
   evas_object_show(bt);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "Show last");
   evas_object_smart_callback_add(bt, "clicked", _show_last_clicked, grid);
   elm_box_pack_end(hbx_1, bt);
   evas_object_show(bt);

   sp = elm_spinner_add(win);
   elm_spinner_min_max_set(sp, 10, 1024);
   elm_spinner_value_set(sp, 150);
   elm_spinner_label_format_set(sp, "Item size: %.0f");
   evas_object_smart_callback_add(sp, "changed", _size_changed, grid);
   evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_box_pack_end(hbx_1, sp);
   evas_object_show(sp);

   hbx_2 = elm_box_add(win);
   evas_object_size_hint_weight_set(hbx_2, EVAS_HINT_EXPAND, 0.0);
   elm_box_horizontal_set(hbx_2, EINA_TRUE);
   elm_box_pack_end(bx, hbx_2);
   evas_object_show(hbx_2);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "Disable item");
   evas_object_smart_callback_add(bt, "clicked", _toggle_disabled_cb, grid);
   elm_box_pack_end(hbx_2, bt);
   evas_object_show(bt);

   ck = elm_check_add(win);
   elm_object_text_set(ck, "Horizontal mode");
   evas_object_smart_callback_add(ck, "changed", _horizontal_grid, grid);
   elm_box_pack_end(hbx_2, ck);
   evas_object_show(ck);

   ck = elm_check_add(win);
   elm_object_text_set(ck, "Always select");
   evas_object_smart_callback_add(ck, "changed", _always_select_change, grid);
   elm_box_pack_end(hbx_2, ck);
   evas_object_show(ck);

   ck = elm_check_add(win);
   elm_scroller_bounce_get(grid, &bounce, NULL);
   elm_object_text_set(ck, "Bouncing");
   elm_check_state_set(ck, bounce);
   evas_object_smart_callback_add(ck, "changed", _bouncing_change, grid);
   elm_box_pack_end(hbx_2, ck);
   evas_object_show(ck);

   ck = elm_check_add(win);
   elm_object_text_set(ck, "Multi-selection");
   elm_check_state_set(ck, elm_gengrid_multi_select_get(grid));
   evas_object_smart_callback_add(ck, "changed", _multi_change, grid);
   elm_box_pack_end(hbx_2, ck);
   evas_object_show(ck);

   ck = elm_check_add(win);
   elm_object_text_set(ck, "No selection");
   evas_object_smart_callback_add(ck, "changed", _no_sel_change, grid);
   elm_box_pack_end(hbx_2, ck);
   evas_object_show(ck);

   hbx_3 = elm_box_add(win);
   evas_object_size_hint_weight_set(hbx_3, EVAS_HINT_EXPAND, 0.0);
   elm_box_horizontal_set(hbx_3, EINA_TRUE);
   elm_box_pack_end(bx, hbx_3);
   evas_object_show(hbx_3);

   elm_gengrid_align_get(grid, &h, &v);
   evas_object_smart_callback_add(grid, "scroll,anim,stop", _grid_scroll_stopped_cb, NULL);

   sl = elm_slider_add(win);
   elm_object_text_set(sl, "Horiz. alignment");
   elm_slider_span_size_set(sl, 100);
   evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND);
   elm_slider_indicator_format_set(sl, "%1.1f");
   elm_slider_value_set(sl, h);
   elm_box_pack_end(hbx_3, sl);
   evas_object_show(sl);

   evas_object_smart_callback_add(sl, "changed", _h_align_change_cb, grid);

   sl = elm_slider_add(win);
   elm_object_text_set(sl, "Vert. alignment");
   elm_slider_span_size_set(sl, 100);
   evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND);
   elm_slider_indicator_format_set(sl, "%1.1f");
   elm_slider_value_set(sl, v);
   elm_box_pack_end(hbx_3, sl);
   evas_object_show(sl);

   evas_object_smart_callback_add(sl, "changed", _v_align_change_cb, grid);

   elm_gengrid_align_get(grid, &h, &v);

   sl = elm_slider_add(win);
   elm_object_text_set(sl, "Page rel. size");
   elm_slider_span_size_set(sl, 100);
   evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND);
   elm_slider_indicator_format_set(sl, "%1.1f");
   elm_slider_value_set(sl, h);
   elm_box_pack_end(hbx_3, sl);
   evas_object_show(sl);

   _page_change_cb(grid, sl, NULL);
   evas_object_smart_callback_add(sl, "changed", _page_change_cb, grid);

   if (!gic)
     {
        gic = elm_gengrid_item_class_new();
        gic->item_style = "default";
        gic->func.text_get = _grid_label_get;
        gic->func.content_get = _grid_content_get;
        gic->func.state_get = _grid_state_get;
        gic->func.del = _grid_del;
     } // we only create the first time its needed. we dont unref/free

   _append_bt_clicked(grid, NULL, NULL);
   _append_bt_clicked(grid, NULL, NULL);
   _append_bt_clicked(grid, NULL, NULL);

   evas_object_resize(win, 600, 600);
   evas_object_show(win);

   elm_run();

   return 0;
}
예제 #6
0
파일: bg_example_03.c 프로젝트: Limsik/e17
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *bg;
   Evas_Object *box, *hbox, *o_bg;
   Evas_Object *rd, *rdg;
   char buf[PATH_MAX];

   elm_app_info_set(elm_main, "elementary", "objects/test.edj");
   win = elm_win_add(NULL, "bg-options", ELM_WIN_BASIC);
   elm_win_title_set(win, "Bg Options");
   evas_object_smart_callback_add(win, "delete,request", on_done, NULL);
   elm_win_autodel_set(win, EINA_TRUE);

   bg = elm_bg_add(win);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, bg);
   evas_object_show(bg);

   box = elm_box_add(win);
   evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, box);
   evas_object_show(box);

   o_bg = elm_bg_add(win);
   snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
   elm_bg_file_set(o_bg, buf, NULL);
   evas_object_size_hint_weight_set(o_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(o_bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_box_pack_end(box, o_bg);
   evas_object_show(o_bg);

   hbox = elm_box_add(win);
   elm_box_horizontal_set(hbox, EINA_TRUE);
   evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
   evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);

   rd = elm_radio_add(win);
   elm_radio_state_value_set(rd, ELM_BG_OPTION_CENTER);
   elm_object_text_set(rd, "Center");
   evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
   evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
   elm_box_pack_end(hbox, rd);
   evas_object_show(rd);
   rdg = rd;

   rd = elm_radio_add(win);
   elm_radio_state_value_set(rd, ELM_BG_OPTION_SCALE);
   elm_radio_group_add(rd, rdg);
   elm_object_text_set(rd, "Scale");
   evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
   evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
   elm_box_pack_end(hbox, rd);
   evas_object_show(rd);

   rd = elm_radio_add(win);
   elm_radio_state_value_set(rd, ELM_BG_OPTION_STRETCH);
   elm_radio_group_add(rd, rdg);
   elm_object_text_set(rd, "Stretch");
   evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
   evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
   elm_box_pack_end(hbox, rd);
   evas_object_show(rd);

   rd = elm_radio_add(win);
   elm_radio_state_value_set(rd, ELM_BG_OPTION_TILE);
   elm_radio_group_add(rd, rdg);
   elm_object_text_set(rd, "Tile");
   evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
   evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
   elm_box_pack_end(hbox, rd);
   evas_object_show(rd);

   elm_radio_value_set(rdg, ELM_BG_OPTION_SCALE);

   rd = elm_check_add(win);
   elm_object_text_set(rd, "Show Overlay");
   evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
   evas_object_smart_callback_add(rd, "changed", _cb_overlay_changed, o_bg);
   elm_box_pack_end(hbox, rd);
   evas_object_show(rd);

   /* color choices ... this is ghetto, but we don't have a 'colorpicker'
    * widget yet :( */
   rd = elm_spinner_add(win);
   elm_object_style_set(rd, "vertical");
   elm_spinner_min_max_set(rd, 1, 4);
   elm_spinner_label_format_set(rd, "%.0f");
   elm_spinner_editable_set(rd, EINA_FALSE);
   elm_spinner_special_value_add(rd, 1, "White");
   elm_spinner_special_value_add(rd, 2, "Red");
   elm_spinner_special_value_add(rd, 3, "Blue");
   elm_spinner_special_value_add(rd, 4, "Green");
   evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_smart_callback_add(rd, "changed", _cb_color_changed, o_bg);
   elm_box_pack_end(hbox, rd);
   evas_object_show(rd);

   elm_box_pack_end(box, hbox);
   evas_object_show(hbox);

   evas_object_resize(win, 460, 320);
   evas_object_show(win);

   elm_run();
   elm_shutdown();

   return 0;
}