617fe69614f2a92388037ecaaa7d16178d64f2bb
[apps/native/sample/sample-core-components.git] / rule / watchface / project / src / view.c
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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 /*
18  * @brief Set text to the part
19  * @param[in] parent Object has part to which you want to set text
20  * @param[in] part_name Part name to which you want to set the text
21  * @param[in] text Text you want to set to the part
22  */
23 void view_set_text(Evas_Object *parent, const char *part_name, const char *text)
24 {
25         if (parent == NULL) {
26                 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
27                 return;
28         }
29
30         /* Set text of target part object */
31         elm_object_part_text_set(parent, part_name, text);
32 }
33
34 /*
35  * @brief Make a layout to target parent object with edje file
36  * @param[in] parent The object to which you want to add this layout
37  * @param[in] file_path File path of EDJ file will be used
38  * @param[in] group_name Name of group in EDJ you want to set to
39  * @param[in] user_data The user data to be passed to the callback functions
40  */
41 Evas_Object *view_create_layout(Evas_Object *parent, const char *file_path, const char *group_name, void *user_data)
42 {
43         Evas_Object *layout = NULL;
44
45         if (parent == NULL) {
46                 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
47                 return NULL;
48         }
49
50         /* Create layout by EDC(edje file) */
51         layout = elm_layout_add(parent);
52         elm_layout_file_set(layout, file_path, group_name);
53
54         /* Layout size setting */
55         evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
56
57         evas_object_show(layout);
58
59         return layout;
60 }