2 * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef __EFL_ASSIST_EVENTS_H__
19 #define __EFL_ASSIST_EVENTS_H__
21 #include <Elementary.h>
28 * @brief Convenient macro function that sends back key events to the popup
31 * @see ea_object_event_callback_add()
34 ea_popup_back_cb(void *data, Evas_Object *obj, void *event_info)
40 * @brief Convenient macro function that sends back key events to the ctxpopup
43 * @see ea_object_event_callback_add()
46 ea_ctxpopup_back_cb(void *data, Evas_Object *obj, void *event_info)
48 elm_ctxpopup_dismiss(obj);
52 * @brief Convenient macro function that sends more key events to the naviframe
54 * @see ea_object_event_callback_add()
57 ea_naviframe_more_cb(void *data, Evas_Object *obj, void *event_info)
59 Elm_Object_Item *top = elm_naviframe_top_item_get(obj);
61 Evas_Object *more_btn = elm_object_item_part_content_get(top, "toolbar_more_btn");
63 evas_object_smart_callback_call(more_btn, "clicked", NULL);
65 elm_object_item_signal_emit(top, "elm,action,more_event", "");
69 * @brief Convenient macro function that pop the naviframe item.
70 * @see ea_object_event_callback_add()
73 ea_naviframe_back_cb(void *data, Evas_Object *obj, void *event_info)
75 elm_naviframe_item_pop(obj);
79 * Identifier of callbacks to be set for Ea events.
81 * @see ea_object_event_callback_add()
82 * @see ea_object_event_callback_del()
84 typedef enum _Ea_Callback_Type
91 /** <Ea event callback function signature */
92 typedef void (*Ea_Event_Cb)(void *data, Evas_Object *obj, void *event_info);
95 * Delete a callback function from an object.
97 * @param[in] obj Object to remove a callback from.
98 * @param[in] type The type of event that was triggering the callback.
99 * @param[in] func The function that was to be called when the event was
101 * @return data The data pointer that was to be passed to the callback.
103 * @brief This function removes the most recently added callback from the
104 * object @p obj which was triggered by the type @p type and
105 * was calling the function @p func when triggered. If the removal is
106 * successful it will also return the data pointer that was passed to
107 * ea_object_event_callback_add() when the callback was added to
108 * the object. If not successful @c NULl will be returned.
110 * @see ea_object_event_callback_add()
113 EAPI void *ea_object_event_callback_del(Evas_Object *obj, Ea_Callback_Type type, Ea_Event_Cb);
116 * Add (register) a callback function to a given evas object.
118 * @param[in] obj evas object.
119 * @param[in] type The type of event that will trigger the callback.
120 * @param[in] func The function to be called when the key event is triggered.
121 * @param[in] data The data pointer to be passed to @p func.
123 * @brief This function adds a function callback to an object when the key event
124 * occurs on object @p obj. The key event on the object is only triggered
125 * when the object is the most top in objects stack and visible. This
126 * means, like the naviframe widget, if your application needs to have
127 * the events based on the view but not focus, you can use this callback.
129 * A callback function must have the Ea_Event_Cb prototype definition.
130 * The first parameter (@p data) in this definition will have the same
131 * value passed to ea_object_event_callback_add() as the @p data
132 * parameter, at runtime. The second parameter @p obj is the evas object
133 * on which event occurred. Finally, the third parameter @p event_info is
134 * a pointer to a data structure that may or may not be passed to the
135 * callback, depending on the event type that triggered the callback.
136 * This is so because some events don't carry extra context with them,
139 * @see ea_object_event_callback_del()
142 EAPI void ea_object_event_callback_add(Evas_Object *obj, Ea_Callback_Type type, Ea_Event_Cb func, void *data);
148 #endif /* __EFL_ASSIST_EVENTS_H__ */