diff options
Diffstat (limited to 'src/ui/bt-widget.c')
-rw-r--r-- | src/ui/bt-widget.c | 194 |
1 files changed, 112 insertions, 82 deletions
diff --git a/src/ui/bt-widget.c b/src/ui/bt-widget.c index 4706923..2b23540 100644 --- a/src/ui/bt-widget.c +++ b/src/ui/bt-widget.c @@ -1,23 +1,34 @@ /* - * Copyright (c) 2012-2013 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://floralicense.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. - */ +* ug-bluetooth-efl +* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Contact: Hocheol Seo <hocheol.seo@samsung.com> +* GirishAshok Joshi <girish.joshi@samsung.com> +* DoHyun Pyun <dh79.pyun@samsung.com> +* +* 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 "bt-debug.h" #include "bt-widget.h" #include "bt-main-ug.h" #include "bt-type-define.h" +#include "bt-string-define.h" + +#define COLOR_TABLE "/usr/apps/ug-bluetooth-efl/res/tables/ug-bluetooth-efl_ChangeableColorTable.xml" +#define FONT_TABLE "/usr/apps/ug-bluetooth-efl/res/tables/ug-bluetooth-efl_FontInfoTable.xml" Evas_Object *_bt_create_naviframe(Evas_Object *parent) { @@ -25,7 +36,7 @@ Evas_Object *_bt_create_naviframe(Evas_Object *parent) Evas_Object *nf; - retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); + retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL"); nf = elm_naviframe_add(parent); elm_object_part_content_set(parent, "elm.swallow.content", nf); @@ -38,42 +49,34 @@ Evas_Object *_bt_create_naviframe(Evas_Object *parent) Evas_Object *_bt_create_icon(Evas_Object *parent, char *img) { - FN_START; - Evas_Object *ic; - char buf[BT_IMG_PATH_MAX] = { 0, }; - - retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); - retvm_if(img == NULL, NULL, "Invalid argument: img is NULL\n"); - if (strlen(img) >= BT_IMG_PATH_MAX) { - BT_DBG("image path is wrong [%s]", img); - } + retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL"); + retvm_if(img == NULL, NULL, "Invalid argument: img is NULL"); + retvm_if(strlen(img) >= BT_IMG_PATH_MAX, NULL, "image path is wrong [%s]", img); ic = elm_image_add(parent); - snprintf(buf, BT_IMG_PATH_MAX, "%s", img); - elm_image_file_set(ic, BT_ICON_EDJ, buf); + elm_image_file_set(ic, BT_ICON_EDJ, img); + evas_object_size_hint_align_set(ic, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); +/* evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); elm_image_resizable_set(ic, 1, 1); - +*/ evas_object_show(ic); - FN_END; - return ic; } Evas_Object *_bt_create_button(Evas_Object *parent, char *style, char *text, char *icon_path, Evas_Smart_Cb func, void *data) { - FN_START; - Evas_Object *btn = NULL; Evas_Object *icon = NULL; - retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); + retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL"); btn = elm_button_add(parent); if (style) @@ -93,8 +96,6 @@ Evas_Object *_bt_create_button(Evas_Object *parent, char *style, char *text, evas_object_show(btn); - FN_END; - return btn; } @@ -105,7 +106,7 @@ Evas_Object *_bt_modify_button(Evas_Object *btn, char *style, char *text, Evas_Object *icon = NULL; - retvm_if(btn == NULL, NULL, "Invalid argument: parent is NULL\n"); + retvm_if(btn == NULL, NULL, "Invalid argument: parent is NULL"); if (style) elm_object_style_set(btn, style); @@ -134,7 +135,7 @@ Evas_Object *_bt_create_progressbar(Evas_Object *parent, const char *style) Evas_Object *progress_bar = NULL; - retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); + retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL"); progress_bar = elm_progressbar_add(parent); @@ -143,6 +144,7 @@ Evas_Object *_bt_create_progressbar(Evas_Object *parent, const char *style) else elm_object_style_set(progress_bar, "process_large"); + elm_progressbar_horizontal_set(progress_bar, EINA_TRUE); evas_object_propagate_events_set(progress_bar, EINA_FALSE); evas_object_show(progress_bar); elm_progressbar_pulse(progress_bar, EINA_TRUE); @@ -158,7 +160,7 @@ Evas_Object *_bt_create_genlist(Evas_Object *parent) Evas_Object *genlist = NULL; - retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); + retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL"); genlist = elm_genlist_add(parent); evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, @@ -183,7 +185,7 @@ Evas_Object *_bt_create_separator(Evas_Object *parent, const char *style) Evas_Object *separator = NULL; - retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); + retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL"); separator = elm_separator_add(parent); elm_separator_horizontal_set(separator, EINA_TRUE); @@ -200,7 +202,7 @@ Evas_Object *_bt_create_box(Evas_Object *parent) Evas_Object *box = NULL; - retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); + retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL"); box = elm_box_add(parent); evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0); @@ -211,34 +213,13 @@ Evas_Object *_bt_create_box(Evas_Object *parent) return box; } -Evas_Object *_bt_create_controlbar(Evas_Object *parent, char *style) -{ - FN_START; - - Evas_Object *toolbar = NULL; - - retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); - - toolbar = elm_toolbar_add(parent); - elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND); - - if (style) - elm_object_style_set(toolbar, style); - - evas_object_show(toolbar); - - FN_END; - - return toolbar; -} - Evas_Object *_bt_create_scroller(Evas_Object *parent, Evas_Object *ly) { FN_START; Evas_Object *scroller; - retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); + retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL"); scroller = elm_scroller_add(parent); @@ -257,24 +238,22 @@ Evas_Object *_bt_create_scroller(Evas_Object *parent, Evas_Object *ly) } -Evas_Object *_bt_create_bg(Evas_Object *parent, char *style) +static Evas_Object *__bt_create_bg(Evas_Object *parent, char *style) { FN_START; Evas_Object *bg; - retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); + retvm_if(!parent, NULL, "Invalid argument: parent is NULL"); bg = elm_bg_add(parent); - - evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); + retv_if(!bg, NULL); if (style) elm_object_style_set(bg, style); - elm_win_resize_object_add(parent, bg); - + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_show(bg); FN_END; @@ -288,7 +267,7 @@ Evas_Object *_bt_create_layout(Evas_Object *parent, char *edj, char *content) Evas_Object *layout; - retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); + retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL"); layout = elm_layout_add(parent); @@ -308,30 +287,54 @@ Evas_Object *_bt_create_layout(Evas_Object *parent, char *edj, char *content) return layout; } -Evas_Object *_bt_create_conformant(Evas_Object *parent, Evas_Object *content) +Evas_Object *_bt_main_layout_conform_create(Evas_Object *parent, + void *data) { FN_START; - + Evas_Object *layout = NULL; Evas_Object *conform = NULL; - elm_win_conformant_set(parent, 1); - conform = elm_conformant_add(parent); - elm_object_style_set(conform, "internal_layout"); + conform = (Evas_Object*) app_get_preinitialized_conformant(); + if (!conform) + conform = elm_conformant_add(parent); + retv_if(!conform, NULL); + + bt_ug_data *ugd = (bt_ug_data *)data; + + /* Base Layout */ + layout = elm_layout_add(conform); + retv_if(!layout, NULL); + + elm_layout_theme_set(layout, "layout", "application", "default"); + evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(conform, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(parent, conform); + elm_object_content_set(conform, layout); + + Evas_Object *bg = __bt_create_bg(layout, "group_list"); + elm_object_part_content_set(layout, "elm.swallow.bg", bg); + evas_object_show(layout); + + elm_win_conformant_set(ugd->win_main, EINA_TRUE); evas_object_show(conform); - if (content) - elm_object_content_set(conform, content); + /* Conformant bg */ + Evas_Object *conformant_bg = elm_bg_add(conform); + elm_object_style_set(conformant_bg, "indicator/headerbg"); + elm_object_part_content_set(conform, "elm.swallow.indicator_bg", conformant_bg); + evas_object_show(conformant_bg); + ugd->conform = conform; + evas_object_data_set(parent, "conformant", conform); FN_END; - - return conform; + return layout; } Evas_Object *_bt_create_popup(Evas_Object *parent, char *title, char *text, void *cb, void *cb_data, int timer_val) { FN_START; - retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); + retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL"); Evas_Object *popup = NULL; @@ -356,8 +359,35 @@ Evas_Object *_bt_create_popup(Evas_Object *parent, char *title, char *text, if (timer_val != 0) elm_popup_timeout_set(popup, (double)timer_val); - evas_object_show(popup); - FN_END; return popup; -}
\ No newline at end of file +} + +Ea_Theme_Color_Table *_bt_color_table_set(void) +{ + FN_START; + Ea_Theme_Color_Table *table = NULL; + + table = ea_theme_color_table_new(COLOR_TABLE); + retv_if(!table, NULL); + + BT_DBG("Bluetooth color table : %p", table); + ea_theme_colors_set(table, EA_THEME_STYLE_DEFAULT); + FN_END; + return table; +} + +Ea_Theme_Font_Table *_bt_font_table_set(void) +{ + FN_START; + Ea_Theme_Font_Table *table = NULL; + + table = ea_theme_font_table_new(FONT_TABLE); + retv_if(!table, NULL); + ea_theme_fonts_set(table); + + BT_DBG("Bluetooth font table : %p", table); + FN_END; + return table; +} + |