forked from enlightenment/efl
1. add signal emits for scrolling in photocam
2. standardise all callback names to be x,y,z etc. if they have multiple words. 3. add cal to get the region viewed 4. test photocams signals and new call SVN revision: 43069
This commit is contained in:
parent
0648ca2875
commit
c3ccf673e8
|
@ -1,5 +1,120 @@
|
|||
#include <Elementary.h>
|
||||
#ifndef ELM_LIB_QUICKLAUNCH
|
||||
|
||||
static void
|
||||
my_ph_clicked(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
printf("clicked\n");
|
||||
}
|
||||
|
||||
static void
|
||||
my_ph_press(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
printf("press\n");
|
||||
}
|
||||
|
||||
static void
|
||||
my_ph_longpressed(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
printf("longpressed\n");
|
||||
}
|
||||
|
||||
static void
|
||||
my_ph_clicked_double(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
printf("clicked,double\n");
|
||||
}
|
||||
|
||||
static void
|
||||
my_ph_load(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
printf("load\n");
|
||||
}
|
||||
|
||||
static void
|
||||
my_ph_loaded(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
printf("loaded\n");
|
||||
}
|
||||
|
||||
static void
|
||||
my_ph_load_details(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
printf("load,details\n");
|
||||
}
|
||||
|
||||
static void
|
||||
my_ph_loaded_details(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
printf("loaded,details\n");
|
||||
}
|
||||
|
||||
static void
|
||||
my_ph_zoom_start(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
printf("zoom,start\n");
|
||||
}
|
||||
|
||||
static void
|
||||
my_ph_zoom_stop(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
printf("zoom,stop\n");
|
||||
}
|
||||
|
||||
static void
|
||||
my_ph_zoom_change(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
printf("zoom,change\n");
|
||||
}
|
||||
|
||||
static void
|
||||
my_ph_anim_start(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
printf("anim,start\n");
|
||||
}
|
||||
|
||||
static void
|
||||
my_ph_anim_stop(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
printf("anim,stop\n");
|
||||
}
|
||||
|
||||
static void
|
||||
my_ph_drag_start(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
printf("drag,start\n");
|
||||
}
|
||||
|
||||
static void
|
||||
my_ph_drag_stop(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
printf("drag_stop\n");
|
||||
}
|
||||
|
||||
static void
|
||||
my_ph_scroll(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win = data;
|
||||
int x, y, w, h;
|
||||
elm_photocam_region_get(obj, &x, &y, &w, &h);
|
||||
printf("scroll %i %i %ix%i\n", x, y, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
sel_done(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
|
@ -115,6 +230,23 @@ test_photocam(void *data, Evas_Object *obj, void *event_info)
|
|||
elm_win_resize_object_add(win, ph);
|
||||
evas_object_data_set(ph, "window", win);
|
||||
|
||||
evas_object_smart_callback_add(ph, "clicked", my_ph_clicked, win);
|
||||
evas_object_smart_callback_add(ph, "press", my_ph_press, win);
|
||||
evas_object_smart_callback_add(ph, "longpressed", my_ph_longpressed, win);
|
||||
evas_object_smart_callback_add(ph, "clicked,double", my_ph_clicked_double, win);
|
||||
evas_object_smart_callback_add(ph, "load", my_ph_load, win);
|
||||
evas_object_smart_callback_add(ph, "loaded", my_ph_loaded, win);
|
||||
evas_object_smart_callback_add(ph, "load,details", my_ph_load_details, win);
|
||||
evas_object_smart_callback_add(ph, "loaded,details", my_ph_loaded_details, win);
|
||||
evas_object_smart_callback_add(ph, "zoom,start", my_ph_zoom_start, win);
|
||||
evas_object_smart_callback_add(ph, "zoom,stop", my_ph_zoom_stop, win);
|
||||
evas_object_smart_callback_add(ph, "zoom,change", my_ph_zoom_change, win);
|
||||
evas_object_smart_callback_add(ph, "scroll,anim,start", my_ph_anim_start, win);
|
||||
evas_object_smart_callback_add(ph, "scroll,anim,stop", my_ph_anim_stop, win);
|
||||
evas_object_smart_callback_add(ph, "scroll,drag,start", my_ph_drag_start, win);
|
||||
evas_object_smart_callback_add(ph, "scroll,drag,stop", my_ph_drag_stop, win);
|
||||
evas_object_smart_callback_add(ph, "scroll", my_ph_scroll, win);
|
||||
|
||||
elm_photocam_file_set(ph, img[1]);
|
||||
|
||||
evas_object_show(ph);
|
||||
|
|
|
@ -943,6 +943,7 @@ extern "C" {
|
|||
EAPI void elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode);
|
||||
EAPI Elm_Photocam_Zoom_Mode elm_photocam_zoom_mode_get(Evas_Object *obj);
|
||||
EAPI void elm_photocam_image_size_get(Evas_Object *obj, int *w, int *h);
|
||||
EAPI void elm_photocam_region_get(Evas_Object *obj, int *x, int *y, int *w, int *h);
|
||||
EAPI void elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h);
|
||||
EAPI void elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h);
|
||||
/* smart callbacks called:
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*
|
||||
* The Bubble is an widget used to show a text in a frame as speach is
|
||||
* represented in comics.
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct _Widget_Data Widget_Data;
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
* arrows etc.) or a custom file (PNG, JPG, EDJE etc.) used for an
|
||||
* icon. The Icon may scale or not and of course... support alpha
|
||||
* channels.
|
||||
*
|
||||
* Signals that you can add callbacks for are:
|
||||
*
|
||||
* clicked - This is called when a user has clicked the icon
|
||||
*/
|
||||
|
||||
typedef struct _Widget_Data Widget_Data;
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
* arrows etc.) or a custom file (PNG, JPG, EDJE etc.) used for an
|
||||
* icon. The Icon may scale or not and of course... support alpha
|
||||
* channels.
|
||||
*
|
||||
* Signals that you can add callbacks for are:
|
||||
*
|
||||
* clicked - This is called when a user has clicked the image
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct _Widget_Data Widget_Data;
|
||||
|
|
|
@ -6,6 +6,11 @@
|
|||
*
|
||||
* For displaying the photo of a person (contact). Simple yet
|
||||
* with a very specific purpose.
|
||||
*
|
||||
* Signals that you can add callbacks for are:
|
||||
*
|
||||
* clicked - This is called when a user has clicked the photo
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct _Widget_Data Widget_Data;
|
||||
|
|
|
@ -38,6 +38,16 @@
|
|||
*
|
||||
* zoom,change - Zoom changed when using an auto zoom mode.
|
||||
*
|
||||
* scroll - the content has been scrolled (moved)
|
||||
*
|
||||
* scroll,anim,start - scrolling animation has started
|
||||
*
|
||||
* scroll,anim,stop - scrolling animation has stopped
|
||||
*
|
||||
* scroll,drag,start - dragging the contents around has started
|
||||
*
|
||||
* scroll,drag,stop - dragging the contents around has stopped
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* TODO (maybe - optional future stuff):
|
||||
|
@ -843,6 +853,36 @@ _freeze_off(void *data, Evas_Object *obj, void *event_info)
|
|||
elm_smart_scroller_freeze_set(wd->scr, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
_scr_anim_start(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
evas_object_smart_callback_call(data, "scroll,anim,start", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_scr_anim_stop(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
evas_object_smart_callback_call(data, "scroll,anim,stop", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_scr_drag_start(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
evas_object_smart_callback_call(data, "scroll,drag,start", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_scr_drag_stop(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
evas_object_smart_callback_call(data, "scroll,drag,stop", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_scr_scroll(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
evas_object_smart_callback_call(data, "scroll", NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new Photocam object
|
||||
*
|
||||
|
@ -876,6 +916,12 @@ elm_photocam_add(Evas_Object *parent)
|
|||
evas_object_smart_callback_add(wd->scr, "drag", _scr, obj);
|
||||
elm_widget_resize_object_set(obj, wd->scr);
|
||||
|
||||
evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj);
|
||||
evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj);
|
||||
evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj);
|
||||
evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj);
|
||||
evas_object_smart_callback_add(wd->scr, "scroll", _scr_scroll, obj);
|
||||
|
||||
elm_smart_scroller_bounce_allow_set(wd->scr, 1, 1);
|
||||
|
||||
wd->obj = obj;
|
||||
|
@ -1297,6 +1343,54 @@ elm_photocam_image_size_get(Evas_Object *obj, int *w, int *h)
|
|||
if (h) *h = wd->size.imh;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current area of the image that is currently shown
|
||||
*
|
||||
* This gets the region
|
||||
*
|
||||
*/
|
||||
EAPI void
|
||||
elm_photocam_region_get(Evas_Object *obj, int *x, int *y, int *w, int *h)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
Evas_Coord sx, sy, sw, sh;
|
||||
int iw, ih;
|
||||
|
||||
elm_smart_scroller_child_pos_get(wd->scr, &sx, &sy);
|
||||
elm_smart_scroller_child_viewport_size_get(wd->scr, &sw, &sh);
|
||||
if (wd->size.w > 0)
|
||||
{
|
||||
if (x)
|
||||
{
|
||||
*x = (wd->size.imw * sx) / wd->size.w;
|
||||
if (*x > wd->size.imw) *x = wd->size.imw;
|
||||
else if (*x < 0) *x = 0;
|
||||
}
|
||||
if (w)
|
||||
{
|
||||
*w = (wd->size.imw * sw) / wd->size.w;
|
||||
if (*w > wd->size.imw) *w = wd->size.imw;
|
||||
else if (*w < 0) *w = 0;
|
||||
}
|
||||
}
|
||||
if (wd->size.h > 0)
|
||||
{
|
||||
if (y)
|
||||
{
|
||||
*y = (wd->size.imh * sy) / wd->size.h;
|
||||
if (*y > wd->size.imh) *y = wd->size.imh;
|
||||
else if (*y < 0) *y = 0;
|
||||
}
|
||||
if (h)
|
||||
{
|
||||
*h = (wd->size.imh * sh) / wd->size.h;
|
||||
if (*h > wd->size.imh) *h = wd->size.imh;
|
||||
else if (*h < 0) *h = 0;
|
||||
}
|
||||
}
|
||||
wd->size.w;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the viewed portion of the image
|
||||
*
|
||||
|
|
|
@ -12,23 +12,23 @@
|
|||
*
|
||||
* Signals that you can add callbacks for are:
|
||||
*
|
||||
* edge_left - the left edge of the content has been reached
|
||||
* edge,left - the left edge of the content has been reached
|
||||
*
|
||||
* edge_right - the right edge of the content has been reached
|
||||
* edge,right - the right edge of the content has been reached
|
||||
*
|
||||
* edge_top - the top edge of the content has been reached
|
||||
* edge,top - the top edge of the content has been reached
|
||||
*
|
||||
* edge_bottom - the bottom edge of the content has been reached
|
||||
* edge,bottom - the bottom edge of the content has been reached
|
||||
*
|
||||
* scroll - the content has been scrolled (moved)
|
||||
*
|
||||
* scroll_anim_start - scrolling animation has started
|
||||
* scroll,anim,start - scrolling animation has started
|
||||
*
|
||||
* scroll_anim_stop - scrolling animation has stopped
|
||||
* scroll,anim,stop - scrolling animation has stopped
|
||||
*
|
||||
* scroll_drag_start - dragging the contents around has started
|
||||
* scroll,drag,start - dragging the contents around has started
|
||||
*
|
||||
* scroll_drag_stop - dragging the contents around has stopped
|
||||
* scroll,drag,stop - dragging the contents around has stopped
|
||||
*/
|
||||
typedef struct _Widget_Data Widget_Data;
|
||||
|
||||
|
@ -171,25 +171,25 @@ _resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||
static void
|
||||
_edge_left(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
evas_object_smart_callback_call(data, "edge_left", NULL);
|
||||
evas_object_smart_callback_call(data, "edge,left", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_edge_right(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
evas_object_smart_callback_call(data, "edge_right", NULL);
|
||||
evas_object_smart_callback_call(data, "edge,right", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_edge_top(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
evas_object_smart_callback_call(data, "edge_top", NULL);
|
||||
evas_object_smart_callback_call(data, "edge,top", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_edge_bottom(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
evas_object_smart_callback_call(data, "edge_bottom", NULL);
|
||||
evas_object_smart_callback_call(data, "edge,bottom", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -201,25 +201,25 @@ _scroll(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||
static void
|
||||
_scroll_anim_start(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
evas_object_smart_callback_call(data, "scroll_anim_start", NULL);
|
||||
evas_object_smart_callback_call(data, "scroll,anim,start", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_scroll_anim_stop(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
evas_object_smart_callback_call(data, "scroll_anim_stop", NULL);
|
||||
evas_object_smart_callback_call(data, "scroll,anim,stop", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_scroll_drag_start(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
evas_object_smart_callback_call(data, "scroll_drag_start", NULL);
|
||||
evas_object_smart_callback_call(data, "scroll,drag,start", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_scroll_drag_stop(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
evas_object_smart_callback_call(data, "scroll_drag_stop", NULL);
|
||||
evas_object_smart_callback_call(data, "scroll,drag,stop", NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,7 +55,8 @@ _elm_win_focus_in(Ecore_Evas *ee)
|
|||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
evas_object_smart_callback_call(win->win_obj, "focus-in", NULL);
|
||||
evas_object_smart_callback_call(win->win_obj, "focus-in", NULL); // FIXME: remove me
|
||||
evas_object_smart_callback_call(win->win_obj, "focus,in", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -66,7 +67,8 @@ _elm_win_focus_out(Ecore_Evas *ee)
|
|||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
evas_object_smart_callback_call(win->win_obj, "focus-out", NULL);
|
||||
evas_object_smart_callback_call(win->win_obj, "focus-out", NULL); // FIXME: remove me
|
||||
evas_object_smart_callback_call(win->win_obj, "focus,out", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -127,7 +129,8 @@ _elm_win_delete_request(Ecore_Evas *ee)
|
|||
if (!win) return;
|
||||
int autodel = win->autodel;
|
||||
win->autodel_clear = &autodel;
|
||||
evas_object_smart_callback_call(win->win_obj, "delete-request", NULL);
|
||||
evas_object_smart_callback_call(win->win_obj, "delete-request", NULL); // FIXME: remove me
|
||||
evas_object_smart_callback_call(win->win_obj, "delete,request", NULL);
|
||||
// FIXME: if above callback deletes - then the below will be invalid
|
||||
if (autodel) evas_object_del(win->win_obj);
|
||||
else win->autodel_clear = NULL;
|
||||
|
|
Loading…
Reference in New Issue