summaryrefslogtreecommitdiff
path: root/src/lib/elementary/elm_popup_eo.h
blob: f8055dda93a81f7f95c2ac3303439a777177c7df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
#ifndef _ELM_POPUP_EO_H_
#define _ELM_POPUP_EO_H_

#ifndef _ELM_POPUP_EO_CLASS_TYPE
#define _ELM_POPUP_EO_CLASS_TYPE

typedef Eo Elm_Popup;

#endif

#ifndef _ELM_POPUP_EO_TYPES
#define _ELM_POPUP_EO_TYPES

/**
 * @brief Possible orient values for popup.
 *
 * These values should be used in conjunction to elm_popup_orient_set() to set
 * the position in which the popup should appear(relative to its parent) and in
 * conjunction with elm_popup_orient_get() to know where the popup is
 * appearing.
 *
 * @ingroup Elm_Popup
 */
typedef enum
{
  ELM_POPUP_ORIENT_TOP = 0, /**< Popup should appear in the top of parent,
                             * default. */
  ELM_POPUP_ORIENT_CENTER, /**< Popup should appear in the center of parent. */
  ELM_POPUP_ORIENT_BOTTOM, /**< Popup should appear in the bottom of parent. */
  ELM_POPUP_ORIENT_LEFT, /**< Popup should appear in the left of parent. */
  ELM_POPUP_ORIENT_RIGHT, /**< Popup should appear in the right of parent. */
  ELM_POPUP_ORIENT_TOP_LEFT, /**< Popup should appear in the top left of parent.
                              */
  ELM_POPUP_ORIENT_TOP_RIGHT, /**< Popup should appear in the top right of
                               * parent. */
  ELM_POPUP_ORIENT_BOTTOM_LEFT, /**< Popup should appear in the bottom left of
                                 * parent. */
  ELM_POPUP_ORIENT_BOTTOM_RIGHT, /**< Notify should appear in the bottom right
                                  * of parent. */
  ELM_POPUP_ORIENT_LAST /**< Sentinel value to indicate last enum field during
                         * iteration */
} Elm_Popup_Orient;


#endif
/** Elementary popup class
 *
 * @ingroup Elm_Popup
 */
#define ELM_POPUP_CLASS elm_popup_class_get()

EWAPI const Efl_Class *elm_popup_class_get(void) EINA_CONST;

/**
 * @brief Set the alignment of the popup object.
 *
 * Sets the alignment in which the popup will appear in its parent.
 *
 * @param[in] obj The object.
 * @param[in] horizontal The horizontal alignment of the popup.
 * @param[in] vertical The vertical alignment of the popup.
 *
 * @since 1.9
 *
 * @ingroup Elm_Popup
 */
EOAPI void elm_obj_popup_align_set(Eo *obj, double horizontal, double vertical);

/**
 * @brief Get the alignment of the popup object.
 *
 * @param[in] obj The object.
 * @param[out] horizontal The horizontal alignment of the popup.
 * @param[out] vertical The vertical alignment of the popup.
 *
 * @since 1.9
 *
 * @ingroup Elm_Popup
 */
EOAPI void elm_obj_popup_align_get(const Eo *obj, double *horizontal, double *vertical);

/**
 * @brief Sets whether events should be passed to by a click outside.
 *
 * Enabling allow event will remove the Blocked event area and events will pass
 * to the lower layer objects otherwise they are blocked.
 *
 * @note The default value is @c false.
 *
 * @param[in] obj The object.
 * @param[in] allow If @c true, events are passed to lower objects.
 *
 * @ingroup Elm_Popup
 */
EOAPI void elm_obj_popup_allow_events_set(Eo *obj, Eina_Bool allow);

/**
 * @brief Returns value indicating whether allow event is enabled or not.
 *
 * @param[in] obj The object.
 *
 * @return If @c true, events are passed to lower objects.
 *
 * @ingroup Elm_Popup
 */
EOAPI Eina_Bool elm_obj_popup_allow_events_get(const Eo *obj);

/**
 * @brief Control the wrapping type of content text packed in content area of
 * popup object.
 *
 * @param[in] obj The object.
 * @param[in] wrap Wrapping type of type Elm_Wrap_Type.
 *
 * @ingroup Elm_Popup
 */
EOAPI void elm_obj_popup_content_text_wrap_type_set(Eo *obj, Elm_Wrap_Type wrap);

/**
 * @brief Control the wrapping type of content text packed in content area of
 * popup object.
 *
 * @param[in] obj The object.
 *
 * @return Wrapping type of type Elm_Wrap_Type.
 *
 * @ingroup Elm_Popup
 */
EOAPI Elm_Wrap_Type elm_obj_popup_content_text_wrap_type_get(const Eo *obj);

/**
 * @brief Sets the orientation of the popup in the parent region.
 *
 * Sets the position in which popup will appear in its parent. By default,
 * #ELM_POPUP_ORIENT_CENTER is set.
 *
 * @param[in] obj The object.
 * @param[in] orient The orientation of the popup.
 *
 * @ingroup Elm_Popup
 */
EOAPI void elm_obj_popup_orient_set(Eo *obj, Elm_Popup_Orient orient);

/**
 * @brief Returns the orientation of the popup.
 *
 * @param[in] obj The object.
 *
 * @return The orientation of the popup.
 *
 * @ingroup Elm_Popup
 */
EOAPI Elm_Popup_Orient elm_obj_popup_orient_get(const Eo *obj);

/**
 * @brief Sets a timeout to hide popup automatically
 *
 * This function sets a timeout and starts the timer controlling when the popup
 * is hidden. Since calling @ref evas_object_show on a popup restarts the timer
 * controlling when it is hidden, setting this before the  popup is shown will
 * in effect mean starting the timer when the popup is shown. Smart signal
 * "timeout" is called afterwards which can be handled if needed.
 *
 * @note Set a value <= 0.0 to disable a running timer.
 *
 * @note If the value > 0.0 and the popup is previously visible, the timer will
 * be started with this value, canceling any running timer.
 *
 * @param[in] obj The object.
 * @param[in] timeout The timeout in seconds.
 *
 * @ingroup Elm_Popup
 */
EOAPI void elm_obj_popup_timeout_set(Eo *obj, double timeout);

/**
 * @brief Returns the timeout value set to the popup (in seconds).
 *
 * @param[in] obj The object.
 *
 * @return The timeout in seconds.
 *
 * @ingroup Elm_Popup
 */
EOAPI double elm_obj_popup_timeout_get(const Eo *obj);

/**
 * @brief Enable or disable scroller in popup content area
 *
 * Normally content area does not contain scroller.
 *
 * @param[in] obj The object.
 * @param[in] scroll @c true if it is to be scrollable, @c false otherwise.
 *
 * @since 1.15.1
 *
 * @ingroup Elm_Popup
 */
EOAPI void elm_obj_popup_scrollable_set(Eo *obj, Eina_Bool scroll);

/**
 * @brief Get the scrollable state of popup content area
 *
 * Normally content area does not contain scroller.
 *
 * @param[in] obj The object.
 *
 * @return @c true if it is to be scrollable, @c false otherwise.
 *
 * @since 1.15.1
 *
 * @ingroup Elm_Popup
 */
EOAPI Eina_Bool elm_obj_popup_scrollable_get(const Eo *obj);

/**
 * @brief Add a new item to a Popup object
 *
 * Both an item list and a content could not be set at the same time! once you
 * add an item, the previous content will be removed.
 *
 * @warning When the first item is appended to popup object, any previous
 * content of the content area is deleted. At a time, only one of content,
 * content-text and item(s) can be there in a popup content area.
 *
 * @param[in] obj The object.
 * @param[in] label The Label of the new item.
 * @param[in] icon Icon to be set on new item.
 * @param[in] func Convenience function called when item selected.
 * @param[in] data Data passed to @c func above.
 *
 * @return A handle to the item added or @c null on errors.
 *
 * @ingroup Elm_Popup
 */
EOAPI Elm_Widget_Item *elm_obj_popup_item_append(Eo *obj, const char *label, Efl_Canvas_Object *icon, Evas_Smart_Cb func, const void *data);

/** Dismiss a Popup object.
 *
 * @since 1.17
 *
 * @ingroup Elm_Popup
 */
EOAPI void elm_obj_popup_dismiss(Eo *obj);

EWAPI extern const Efl_Event_Description _ELM_POPUP_EVENT_BLOCK_CLICKED;

/** Called when popup was clicked
 *
 * @ingroup Elm_Popup
 */
#define ELM_POPUP_EVENT_BLOCK_CLICKED (&(_ELM_POPUP_EVENT_BLOCK_CLICKED))

EWAPI extern const Efl_Event_Description _ELM_POPUP_EVENT_TIMEOUT;

/** Called when popup timed out
 *
 * @ingroup Elm_Popup
 */
#define ELM_POPUP_EVENT_TIMEOUT (&(_ELM_POPUP_EVENT_TIMEOUT))

EWAPI extern const Efl_Event_Description _ELM_POPUP_EVENT_ITEM_FOCUSED;

/** Called when popup got focus
 * @return Efl_Object *
 *
 * @ingroup Elm_Popup
 */
#define ELM_POPUP_EVENT_ITEM_FOCUSED (&(_ELM_POPUP_EVENT_ITEM_FOCUSED))

EWAPI extern const Efl_Event_Description _ELM_POPUP_EVENT_ITEM_UNFOCUSED;

/** Called when popup lost focus
 * @return Efl_Object *
 *
 * @ingroup Elm_Popup
 */
#define ELM_POPUP_EVENT_ITEM_UNFOCUSED (&(_ELM_POPUP_EVENT_ITEM_UNFOCUSED))

EWAPI extern const Efl_Event_Description _ELM_POPUP_EVENT_DISMISSED;

/** Called when popup was dismissed
 *
 * @ingroup Elm_Popup
 */
#define ELM_POPUP_EVENT_DISMISSED (&(_ELM_POPUP_EVENT_DISMISSED))

#endif