2012/08/21: tizen 2.0 beta
[apps/home/call-setting.git] / src / cst-reject-msg-ime.c
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.tizenopensource.org/license
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <Elementary.h>
18
19 #include "cst-common.h"
20 #include "cst-common-string.h"
21
22 #include "cst-widget.h"
23 #include "cst-reject-msg-ime.h"
24
25 static Elm_Genlist_Item_Class *itc_ime = NULL;
26 static char *input_string;
27
28 static Evas_Object *__cst_gl_icon_get_reject_msg_ime(void *data, Evas_Object *obj, const char *part)
29 {
30         ENTER(__cst_gl_icon_get_reject_msg_ime);
31         retv_if(data == NULL, NULL);
32         CstUgData_t *ugd = (CstUgData_t *)data;
33
34         if (!strcmp(part, "elm.icon")) {
35                 return _cst_create_ime_editfield(ugd, obj, CST_IME_REJECT_MSG, input_string);
36         }
37
38         return NULL;
39 }
40
41 static Evas_Object *__cst_create_genlist_reject_msg_ime(CstUgData_t *ugd)
42 {
43         ENTER(__cst_create_genlist_reject_msg_ime);
44         Elm_Object_Item *item = NULL;
45         Evas_Object *genlist;
46
47         genlist = elm_genlist_add(ugd->nf);
48         elm_object_style_set(genlist, "dialogue");
49
50         if (!itc_ime)
51                 itc_ime = elm_genlist_item_class_new();
52
53         itc_ime->item_style = "1icon";
54         itc_ime->func.text_get = NULL;
55         itc_ime->func.content_get = __cst_gl_icon_get_reject_msg_ime;
56         itc_ime->func.state_get = NULL;
57         itc_ime->func.del = NULL;
58
59         item = elm_genlist_item_append(genlist, itc_ime,
60                 (void *)ugd, NULL, ELM_GENLIST_ITEM_NONE,
61                 NULL, NULL);
62         return genlist;
63 }
64
65 Evas_Object *_cst_create_reject_message_ime(Evas_Object *parent, char *edit_string, void *data)
66 {
67         ENTER(_cst_create_reject_message_ime);
68         retv_if(NULL == data, NULL);
69         CstUgData_t *ugd = (CstUgData_t *)data;
70
71         Evas_Object *genlist = __cst_create_genlist_reject_msg_ime(ugd);
72         input_string = edit_string;
73         return genlist;
74 }
75