diff options
Diffstat (limited to 'extend/extended-elm.c')
-rw-r--r-- | extend/extended-elm.c | 438 |
1 files changed, 438 insertions, 0 deletions
diff --git a/extend/extended-elm.c b/extend/extended-elm.c new file mode 100644 index 0000000..376900c --- /dev/null +++ b/extend/extended-elm.c @@ -0,0 +1,438 @@ +/* +* +* Copyright 2012 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. +* +*/ + +#include <extended-elm.h> + +/** + * elm_scroller_create + * + * @brief This function is an encapsulated vesion of elm_scroller_add + * + * @param [in] parent The parent object + * + * @return Return pointer to elm object (Success) or NULL (Failed) + * + * @exception None + * + * @remark None + * + * @see + * + */ +Evas_Object *elm_scroller_create(Evas_Object *parent) +{ + Evas_Object *sc; + sc = elm_scroller_add(parent); + elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE); + elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(sc); + return sc; +} + +/** + * elm_layout_create + * + * @brief This function is an encapsulated vesion of elm_layout_add + * + * @param [in] parent The parent object + * + * @param [in] file The path to file (edj) that will be used as layout + * + * @param [in] group The group that the layout belongs in edje file + * + * @return Return pointer to elm object (Success) or NULL (Failed) + * + * @exception None + * + * @remark None + * + * @see + * + */ +Evas_Object *elm_layout_create(Evas_Object *parent, const char *file, const char *group) +{ + Evas_Object *ly; + ly = elm_layout_add(parent); + if (elm_layout_file_set(ly, file, group)) { + evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, 0); + evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, 0); + evas_object_show(ly); + } else { + evas_object_del(ly); + ly = NULL; + } + return ly; +} + +/** + * elm_label_create + * + * @brief This function is an encapsulated vesion of elm_label_add + * + * @param [in] parent The parent object + * + * @param [in] text The label will be used on the object + * + * @return Return pointer to elm object (Success) or NULL (Failed) + * + * @exception None + * + * @remark None + * + * @see + * + */ +Evas_Object *elm_label_create(Evas_Object *parent, const char *text) +{ + Evas_Object *label; + label = elm_label_add(parent); + elm_label_line_wrap_set(label, ELM_WRAP_CHAR); + elm_object_text_set(label, text); + evas_object_size_hint_align_set(label, EVAS_HINT_FILL, 0); + evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0); + evas_object_show(label); + return label; +} + +/** + * elm_check_create + * + * @brief This function is an encapsulated vesion of elm_check_add + * + * @param [in] parent The parent object + * + * @return Return pointer to elm object (Success) or NULL (Failed) + * + * @exception None + * + * @remark None + * + * @see + * + */ +Evas_Object *elm_check_create(Evas_Object *parent) +{ + Evas_Object *check; + check = elm_check_add(parent); + evas_object_size_hint_align_set(check, EVAS_HINT_FILL, 0); + evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0); + evas_object_show(check); + return check; +} + +/** + * elm_button_create + * + * @brief This function is an encapsulated vesion of elm_button_add + * + * @param [in] parent The parent object + * + * @param [in] text The label will be used on the object + * + * @param [in] click_cb The callback function when clicked + * + * @param [in] data User data to be passed to the callback function + * + * @return Return pointer to elm object (Success) or NULL (Failed) + * + * @exception None + * + * @remark None + * + * @see + * + */ +Evas_Object *elm_button_create(Evas_Object *parent, const char *text, Evas_Smart_Cb click_cb, + void *data) +{ + Evas_Object *btn; + btn = elm_button_add(parent); + elm_object_text_set(btn, text); + evas_object_smart_callback_add(btn, "clicked", click_cb, data); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0); + evas_object_show(btn); + return btn; +} + +/** + * elm_entry_create + * + * @brief This function is an encapsulated vesion of elm_entry_add + * + * @param [in] parent The parent object + * + * @param [in] text The label will be used on the object + * + * @return Return pointer to elm object (Success) or NULL (Failed) + * + * @exception None + * + * @remark None + * + * @see + * + */ +Evas_Object *elm_entry_create(Evas_Object *parent, const char *text) +{ + Evas_Object *entry; + entry = elm_entry_add(parent); + elm_entry_entry_set(entry, text); + evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, 0); + evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, 0); + elm_entry_input_panel_enabled_set(entry, EINA_FALSE); + elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT); + evas_object_show(entry); + return entry; +} + +/** + * elm_icon_create + * + * @brief This function is an encapsulated vesion of elm_icon_add + * + * @param [in] parent The parent object + * + * @param [in] file The path of icon file + * + * @return Return pointer to elm object (Success) or NULL (Failed) + * + * @exception None + * + * @remark None + * + * @see + * + */ +Evas_Object *elm_icon_create(Evas_Object *parent, const char *file) +{ + Evas_Object *ic; + ic = elm_icon_add(parent); + elm_icon_file_set(ic, file, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + elm_icon_resizable_set(ic, 1, 1); + evas_object_show(ic); + return ic; +} + +/** + * elm_navigator_btn_create + * + * @brief This function is an encapsulated vesion of elm_icon_add + * + * @param [in] parent The parent object + * + * @param [in] text The label will be used on the object + * + * @param [in] icon_path The icon will be displayed on the object + * + * @param [in] style "navigationbar_control/left(center|right)" + * + * @param [in] click_cb The callback function when clicked + * + * @param [in] data User data to be passed to the callback function + * + * @return Return pointer to elm object (Success) or NULL (Failed) + * + * @exception None + * + * @remark None + * + * @see + * + */ +Evas_Object *elm_navigator_btn_create(Evas_Object *parent, const char *text, + const char *icon_path, const char *style, + Evas_Smart_Cb click_cb, void *data) +{ + Evas_Object *btn = NULL; + + btn = elm_button_create(parent, text, click_cb, data); + elm_object_style_set(btn, "naviframe/title/default"); + return btn; +} + +/** + * elm_swallowed_scroller + * + * @brief This function is an encapsulated vesion of elm_scroller_add + * + * @param [in] parent The parent object + * + * @param [in] part The swallow part name in the parent layout obj + * + * @return Return pointer to elm object (Success) or NULL (Failed) + * + * @exception None + * + * @remark None + * + * @see + * + */ +Evas_Object *elm_swallowed_scroller(Evas_Object *parent, const char *part) +{ + Evas_Object *eo = elm_scroller_create(parent); + elm_object_part_content_set(parent, part, eo); + return eo; +} + +/** + * elm_swallowed_layout + * + * @brief This function is an encapsulated vesion of elm_layout_add + * + * @param [in] parent The parent object + * + * @param [in] part The swallow part name in the parent layout obj + * + * @param [in] file The path to file (edj) that will be used as layout + * + * @param [in] group The group that the layout belongs in edje file + * + * @return Return pointer to elm object (Success) or NULL (Failed) + * + * @exception None + * + * @remark None + * + * @see + * + */ +Evas_Object *elm_swallowed_layout(Evas_Object *parent, const char *part, const char *file, + const char *group) +{ + Evas_Object *eo = elm_layout_create(parent, file, group); + elm_object_part_content_set(parent, part, eo); + return eo; +} + +/** + * elm_swallowed_button + * + * @brief This function is an encapsulated vesion of elm_button_add + * + * @param [in] parent The parent object + * + * @param [in] part The swallow part name in the parent layout obj + * + * @param [in] text The label will be used on the object + * + * @param [in] click_cb The callback function when clicked + * + * @param [in] data User data to be passed to the callback function + * + * @return Return pointer to elm object (Success) or NULL (Failed) + * + * @exception None + * + * @remark None + * + * @see + * + */ +Evas_Object *elm_swallowed_button(Evas_Object *parent, const char *part, const char *text, + Evas_Smart_Cb click_cb, void *data) +{ + Evas_Object *eo = elm_button_create(parent, text, click_cb, data); + elm_object_part_content_set(parent, part, eo); + return eo; +} + +/** + * elm_swallowed_entry + * + * @brief This function is an encapsulated vesion of elm_entry_add + * + * @param [in] parent The parent object + * + * @param [in] part The swallow part name in the parent layout obj + * + * @param [in] text The label will be used on the object + * + * @return Return pointer to elm object (Success) or NULL (Failed) + * + * @exception None + * + * @remark None + * + * @see + * + */ +Evas_Object *elm_swallowed_entry(Evas_Object *parent, const char *part, const char *text) +{ + Evas_Object *eo = elm_entry_create(parent, text); + elm_object_part_content_set(parent, part, eo); + return eo; +} + +/** + * elm_swallowed_icon + * + * @brief This function is an encapsulated vesion of elm_icon_add + * + * @param [in] parent The parent object + * + * @param [in] part The swallow part name in the parent layout obj + * + * @param [in] file The path of icon file + * + * @return Return pointer to elm object (Success) or NULL (Failed) + * + * @exception None + * + * @remark None + * + * @see + * + */ +Evas_Object *elm_swallowed_icon(Evas_Object *parent, const char *part, const char *file) +{ + Evas_Object *eo = elm_icon_create(parent, file); + elm_object_part_content_set(parent, part, eo); + return eo; +} + +/** + * elm_layout_content_del + * + * @brief Destroy object from layout + * + * @param [in] parent The parent object + * + * @param [in] part The name of swallowed part in the parent layout obj + * + * @return None + * + * @exception None + * + * @remark None + * + * @see + * + */ +void elm_layout_content_del(Evas_Object *parent, const char *part) +{ + Evas_Object *eo = elm_object_part_content_unset(parent, part); + if (eo != NULL) { + evas_object_del(eo); + } +} + |