/* Called when the spinner is realized */ static Etk_Bool _etk_spinner_realized_cb(Etk_Object *object, void *data) { Etk_Spinner *spinner; Evas_Object *theme_object; Evas *evas; if (!(spinner = ETK_SPINNER(object)) || !(evas = etk_widget_toplevel_evas_get(ETK_WIDGET(spinner)))) return ETK_TRUE; if (!(theme_object = ETK_WIDGET(spinner)->theme_object)) return ETK_TRUE; /* Create the editable object */ spinner->editable_object = etk_editable_add(evas); evas_object_show(spinner->editable_object); etk_widget_member_object_add(ETK_WIDGET(spinner), spinner->editable_object); etk_editable_theme_set(spinner->editable_object, etk_widget_theme_file_get(ETK_WIDGET(spinner)), etk_widget_theme_group_get(ETK_WIDGET(spinner))); etk_editable_align_set(spinner->editable_object, 1.0); if (!etk_widget_is_focused(ETK_WIDGET(spinner))) { etk_editable_cursor_hide(spinner->editable_object); etk_editable_selection_hide(spinner->editable_object); } if (etk_widget_disabled_get(ETK_WIDGET(spinner))) etk_editable_disabled_set(spinner->editable_object, ETK_TRUE); evas_object_event_callback_add(spinner->editable_object, EVAS_CALLBACK_MOUSE_IN, _etk_spinner_editable_mouse_in_cb, spinner); evas_object_event_callback_add(spinner->editable_object, EVAS_CALLBACK_MOUSE_OUT, _etk_spinner_editable_mouse_out_cb, spinner); evas_object_event_callback_add(spinner->editable_object, EVAS_CALLBACK_MOUSE_DOWN, _etk_spinner_editable_mouse_down_cb, spinner); evas_object_event_callback_add(spinner->editable_object, EVAS_CALLBACK_MOUSE_UP, _etk_spinner_editable_mouse_up_cb, spinner); evas_object_event_callback_add(spinner->editable_object, EVAS_CALLBACK_MOUSE_MOVE, _etk_spinner_editable_mouse_move_cb, spinner); /* Connect the "decrement"/"increment" edje signals to callbacks */ edje_object_signal_callback_add(theme_object, "etk,action,decrement,start", "", _etk_spinner_step_start_cb, spinner); edje_object_signal_callback_add(theme_object, "etk,action,increment,start", "", _etk_spinner_step_start_cb, spinner); edje_object_signal_callback_add(theme_object, "etk,action,decrement,stop", "", _etk_spinner_step_stop_cb, spinner); edje_object_signal_callback_add(theme_object, "etk,action,increment,stop", "", _etk_spinner_step_stop_cb, spinner); /* Update the text of the editable object */ _etk_spinner_update_text_from_value(spinner); return ETK_TRUE; }
/* Adds a rectangle object to the canvas */ static void _etk_test_canvas_object_add(void *data) { Etk_Canvas *canvas; Evas *evas; Evas_Object *object; Etk_Widget *etk_evas_object; int x, y; int cw, ch; if (!(canvas = ETK_CANVAS(data)) || !(evas = etk_widget_toplevel_evas_get(ETK_WIDGET(canvas)))) return; etk_widget_geometry_get(ETK_WIDGET(canvas), NULL, NULL, &cw, &ch); x = rand() % cw; y = rand() % ch; /* Add a rectangle */ if (rand() % 4 != 0) { int w, h; int r, g, b, a; object = evas_object_rectangle_add(evas); w = ETK_MAX(abs(rand() % (cw - x)), 10); h = ETK_MAX(abs(rand() % (ch - y)), 10); evas_object_resize(object, w, h); r = rand() % 255; g = rand() % 255; b = rand() % 255; a = ETK_MAX(rand() % 255, 40); evas_color_argb_premul(a, &r, &g, &b); evas_object_color_set(object, r, g, b, a); etk_evas_object = etk_evas_object_new(); etk_evas_object_set_object(ETK_EVAS_OBJECT(etk_evas_object), object); } /* Or add an image */ else { object = evas_object_image_add(evas); evas_object_image_file_set(object, PACKAGE_DATA_DIR "/images/test.png", NULL); evas_object_image_fill_set(object, 0, 0, 48, 48); evas_object_resize(object, 48, 48); etk_evas_object = etk_evas_object_new(); etk_evas_object_set_object(ETK_EVAS_OBJECT(etk_evas_object), object); } etk_canvas_put(canvas, etk_evas_object, x, y); etk_widget_show_all(etk_evas_object); }