Update codes for TIZEN 2.0
[apps/home/memo.git] / include / memo-assist.h
1 /*
2 *
3 * Copyright 2012  Samsung Electronics Co., Ltd
4 *
5 * Licensed under the Flora License, Version 1.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *    http://www.tizenopensource.org/license
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 #ifndef __MEMO_ASSIST_H__
20 #define __MEMO_ASSIST_H__
21
22 #include <memo-db.h>
23 #include <bundle.h>
24 #include <memo_string.h>
25 #include <ui-gadget.h>
26
27 #define DOODLE_TITLE_PREFIX     "Drawing-"
28
29 #define ARGB_JOIN(a, r, g, b) \
30     (((a) << 24) + ((r) << 16) + ((g) << 8) + (b))
31
32 #define  IN_RECT_CHECK(x, y, rx, ry, rw, rh)\
33     (((unsigned)((x) - (rx)) < (rw)) && ((unsigned)((y) - (ry)) < (rh)))
34
35 #define CLIP_RECT_TO_RECT(x, y, w, h, rx, ry, rw, rh)\
36 {\
37     int   _t0, _t1;\
38 \
39     _t0 = MAX(x, (rx));\
40     _t1 = MIN(x + w, (rx) + (rw));\
41     x = _t0;\
42     w = _t1 - _t0;\
43     _t0 = MAX(y, (ry));\
44     _t1 = MIN(y + h, (ry) + (rh));\
45     y = _t0;\
46     h = _t1 - _t0;\
47 }
48
49 typedef void (*Memo_Component_Callback)(void *data, const char *msg, void *event);
50
51 typedef struct memo_data memo_data_t;
52 typedef struct memo_data_list memo_data_list_t;
53
54 typedef enum {
55     MOUSE_EVENT_INVALID = 0,
56     MOUSE_EVENT_CLICK,
57     MOUSE_EVENT_DRAG_LEFT,
58     MOUSE_EVENT_DRAG_RIGHT,
59     MOUSE_EVENT_DRAG_UP,
60     MOUSE_EVENT_DRAG_DOWN,
61 } mouse_behaviour_t;
62
63 #define MOUSE_POSITION_INVALID 9999
64
65 char * strcasestr (const char *haystack, const char *needle);
66 char * strptime (const char *s, const char *fmt, struct tm *tp);
67 void icu_init();
68 char *memo_get_doodle_title();
69 void memo_time_format(char *buf, int len, time_t time);
70 time_t memo_get_binary_release_date();
71 mouse_behaviour_t mouse_event_identify(int startx, int starty, int endx, int endy);
72 void evas_object_flick_callback_add(Evas_Object *obj, Evas_Smart_Cb on_flick, void *data);
73 void memo_com_dummy_cb(void *data, const char *msg, void *event);
74 void memo_create_yes_no_popup(Evas_Object *win, const char *msg, Evas_Smart_Cb on_yes, Evas_Smart_Cb on_no, void *data);
75 void memo_tool_btn_focus_set(Evas_Object *eo, Eina_Bool status);
76 void *memo_load_font_size_selector(Evas_Object *parent, service_h service, Memo_Component_Callback cb, void *data);
77 void memo_del_font_size_selector(void *h_fss);
78 void *memo_load_color_selector(Evas_Object *parent, service_h service, Memo_Component_Callback cb, void *data);
79 void memo_del_color_selector(void *h_cs);
80 void *memo_load_pencil_size_selector(Evas_Object *parent, service_h service, Memo_Component_Callback cb, void *data);
81 void memo_del_pencil_size_selector(void *h_pss);
82 void memo_navigator_pop(Evas_Object *navi);
83 Elm_Object_Item *memo_naviframe_item_push(Evas_Object *obj, const char *title_label,
84     Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style);
85 Eina_Bool memo_comment_savable(Evas_Object *entry, const char *orig_utf8);
86 void memo_comment_recover(Evas_Object *entry, const char *orig_utf8);
87 Evas_Object *memo_controlbar_add(Evas_Object *parent);
88
89 #endif                /* __MEMO_ASSIST_H__ */