summaryrefslogtreecommitdiff
path: root/main/src/view/ivug-slider-priv.h
blob: 2bc2f3d9c6a7e70029b2b82658ca68a35da6ea08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/*
 * Copyright 2012  Samsung Electronics Co., Ltd
 *
 * Licensed under the Flora License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *	  http://www.tizenopensource.org/license
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


#include "ivug-data.h"

#ifndef __IVUG_SLIDER_PRIV_H__
#define __IVUG_SLIDER_PRIV_H__

/* elm_config_finger_size_get = 40 */
#define IMAGE_BETWEEN_MARGIN		(30)					// The value is width between photocam(unit is pixel).
#define IMAGE_MOVE_MARGIN 			((int)IMAGE_BETWEEN_MARGIN*0.8)
/* If moved width is larger than IMAGE_SCROLL_MARGIN, image is scrolled */
#define IMAGE_SCROLL_MARGIN 		(5) /* vertical move doen't over 5 pixel width */
#define LONG_PRESS_MARGIN 			((int)(elm_config_finger_size_get() / 3))

typedef enum {
	SLIDE_NO_EDGE = (1<<0),

	SLIDE_LEFT_EDGE = (1<<1),
	SLIDE_RIGHT_EDGE = (1<<2),

	SLIDE_TOP_EDGE = (1<<3),
	SLIDE_BOTTOM_EDGE = (1<<4),

	SLIDE_FIT = SLIDE_LEFT_EDGE | SLIDE_RIGHT_EDGE | SLIDE_TOP_EDGE | SLIDE_BOTTOM_EDGE,
} slide_edge_t;

typedef enum {
	SLIDE_SHIFT_NONE = 0x00,
	SLIDE_SHIFT_TO_RIGHT,		// <---------------------Mouse
	SLIDE_SHIFT_TO_LEFT,		// Mouse--------------------->
} shift_direction_t;


//ENUM
typedef enum {
	CENTER_SLIDE,
	NEXT_SLIDE,
	PREV_SLIDE,
	MAX_SLIDE,
} slide_index_t;

// slider
typedef struct Smart_Data
{
 	Evas_Object *obj;				// smart object itself.

	Evas_Object *event_obj;			// Event receiver layer

	Evas_Coord x, y, w, h;			// Geometry of slider

//silde
	Slide_Item* slide[MAX_SLIDE];
//	Media_Item* mitem[MAX_SLIDE];

//data list
	Eina_Bool bShow;

	Media_List*	media_list;		// Storing entire media list.
	Media_Item*	current;		// Current medit item. Is it needed??

	int cur_list_idx;
	int next_list_idx;	/* for slide show */
	int list_total_count;

//Mouse Event
	MouseEvent down;
	MouseEvent up;

// for flick anim
	anim_handle_t *anim;
	Ecore_Animator *animator;
	double t_base;

//slider show.
	slideshow_state_t ss_state;

	Ecore_Timer *ss_timer;	//slide show timer
	ivug_slider_slide_show_finish_cb ss_func;		// Callback for slide show finished
	void* ss_user_data;
	Eina_Bool bSS_StopFlag; /* request slide show stop flag */
	Eina_Bool bSS_SlideFlag; /* it was slided by user during slide show */

//Mouse event handler
	Ivug_Event_Handle mouse_event;

	slide_edge_t edge;

// For detecting long pressed
	Ecore_Timer *long_timer;

// For detecting click
	Ecore_Timer *click_timer;

/* For window loading */
	Ecore_Idler* idler_list;

/* slide show setting */
	double ss_interval_time;
	slide_show_mode ss_mode;

/* slide show effect*/
	Effect_Type effect_type;
	Effect_Engine* effect_engine;

	Ecore_Idler *load_idler;
} _Smart_Data;


#ifdef __cplusplus
extern "C" {
#endif


// Common function between slide show and slider.

#define _ivug_slider_edge_state_get(si) __ivug_slider_edge_state_get(si, __func__, __LINE__)

slide_edge_t __ivug_slider_edge_state_get(Slide_Item *si, const char *func, int line);

void _ivug_slider_slide_update_shift_right(struct Smart_Data *sd);

void _ivug_slider_slide_update_pos(struct Smart_Data *sd, Evas_Coord x, Evas_Coord y);

void _ivug_slider_restore_window_list(struct Smart_Data *sd);


// Common function between slide and slide mouse.

void _ivug_slider_slide_update(struct Smart_Data *sd, int x, int y);

void _ivug_slider_pass_event_to_item(struct Smart_Data *sd, Eina_Bool bPass);

void _ivug_slider_slide_update_shift(struct Smart_Data *sd);


void _ivug_on_mouse_down(Evas_Object *obj, MouseEvent *down, void *data);

void _ivug_on_mouse_up(Evas_Object *obj, MouseEvent *up, void *data);

void _ivug_on_mouse_move(Evas_Object *obj, MouseEvent *prev, MouseEvent *cur, void *data);

#ifdef __cplusplus
}
#endif



#endif // __IVUG_SLIDER_PRIV_H__