Tizen 2.1 base
[apps/core/preloaded/calendar.git] / src / list-base.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://floralicense.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 __CALENDAR_LIST_BASE_H__
20 #define __CALENDAR_LIST_BASE_H__
21
22 extern Elm_Genlist_Item_Class cal_list_itc_h;
23
24 typedef enum {
25         CAL_NOT_TASK = -1,
26         CAL_TASK_NONE = 0,
27         CAL_TASK_NO_DUE_DATE,
28         CAL_TASK_DUE_IN_OVER_ONE_WEEK,
29         CAL_TASK_DUE_WITHIN_A_WEEK,
30         CAL_TASK_DUE_TODAY,
31         CAL_TASK_OVER_DUE,
32 }cal_task_group_item_type;
33
34 // todo: hide this also
35 typedef struct {
36         Elm_Object_Item *it;  // Genlist Item pointer
37         calendar_record_h record;
38         Eina_Bool checked;     // Check status
39         struct tm *tm;
40         cal_task_group_item_type todo_group_type;
41 /////////// For delete view only /////////////
42 // TODO: refactor delete view genlist
43         char *label;
44         char *color_str;
45         Eina_Bool is_before_today;
46 //////////////////////////////////////////////
47 } cal_list_genlist_item_data;
48
49 typedef void* cal_list_base_h;
50
51 typedef void (*cal_list_callback)(void* data);
52
53 cal_list_base_h cal_list_base_create(
54                                 struct appdata *ad, Evas_Object* parent, const char* part_name, bool enable_sweep_menu,
55                                 cal_list_callback select_item_callback, void* select_item_callback_data);
56
57 void cal_list_base_clear(cal_list_base_h list);
58
59 void cal_list_base_delete(cal_list_base_h list);
60
61 Evas_Object* cal_list_base_get_genlist_p(cal_list_base_h list); // todo: get rid of this
62
63 void cal_list_base_add_item(cal_list_base_h list, calendar_record_h record, bool prepend);
64
65 void cal_list_base_add_item_after(cal_list_base_h list, calendar_record_h record, Elm_Object_Item* after);
66
67 int cal_list_base_get_item_count(cal_list_base_h list);
68
69 // todo: encapsulated these properly
70 Elm_Object_Item* cal_list_base_append_genlist_group_item(Evas_Object *genlist,
71                 const Elm_Genlist_Item_Class *itc, const struct tm *tm, cal_task_group_item_type type);
72 Elm_Object_Item* cal_list_base_prepend_genlist_group_item(Evas_Object *genlist,
73                 const Elm_Genlist_Item_Class *itc, const struct tm *tm);
74
75 void cal_list_base_delete_popup(cal_list_base_h list);
76
77 void cal_list_base_delete_popup_idler(cal_list_base_h list);
78
79 void cal_list_base_set_search_text(cal_list_base_h list, const char *search_text);
80 #endif