summaryrefslogtreecommitdiff
path: root/extend/extended-elm.c
blob: 376900cdf141298c0bff7ed6c1ff9695774bdcb4 (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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
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);
    }
}