apply modified CBaseView in application-common
[profile/tv/apps/native/filebrowser.git] / src / views / FbContextView.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15 */
16
17 #include <AppCommon.h>
18
19 #include "define.h"
20 #include "common.h"
21 #include "i18n.h"
22 #include "FbContextView.h"
23 #include "Dummy/DummyContent.h"
24
25 //#define _GET_PRIV(o) evas_object_data_get(o, "CTMDATA");
26 //#define _SET_PRIV(o, data) evas_object_data_set(o, "CTMDATA", data);
27
28 #define FBR_TEXT_SIZE N_("Size")
29 #define FBR_TEXT_FORMAT N_("Format")
30 #define FBR_TEXT_OPEN N_("OPEN")
31 #define FBR_TEXT_LINK N_("Other linkable apps")
32 #define FBR_TEXT_REL N_("Other apps for this type")
33 #define EMPTY_STR ""
34 #define TOTAL_CONTEXT_BTNS 5
35 #define TABLE_MAX_COL 2
36 #define MIN_LABEL_WIDTH 103
37 #define FBR_CTXT_BTN_WPAD 26
38 #define FBR_CTXT_TABLE_WPAD 14
39 #define FBR_CTXT_TABLE_HPAD 14
40
41
42 struct SContextView {
43         Evas_Object *eoWin;
44         Evas_Object *eoBtnOpen;
45         Evas_Object *rel_first[TABLE_MAX_COL];
46         Evas_Object *rel_last[TABLE_MAX_COL];
47         Evas_Object *link_first[TABLE_MAX_COL];
48         Evas_Object *link_last[TABLE_MAX_COL];
49
50         CExtNameInfo *finfo;
51
52         CDummyContent content;
53
54         SContextView() {
55                 eoWin = NULL;
56                 eoBtnOpen = NULL;
57                 int a;
58                 for (a = 0; a < TABLE_MAX_COL; a++) {
59                         rel_first[a] = NULL;
60                         rel_last[a] = NULL;
61                         link_first[a] = NULL;
62                         link_last[a] = NULL;
63                 }
64                 finfo = NULL;
65                 pHandlerButton = new SContextView::CHandlerButton(this);
66         }
67         ~SContextView() {
68                 delete pHandlerButton;
69         }
70
71         class CHandlerButton : public CListenerMgr, IMouseMoveListener, IMouseUpListener, ISKeyUpListener {
72                 SContextView *m;
73         public:
74                 CHandlerButton(SContextView *ins) : IMouseMoveListener(this), IMouseUpListener(this), ISKeyUpListener(this) { m = ins; }
75
76                 virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev) {
77                         if (!elm_object_focus_get(obj))
78                                 elm_object_focus_set(obj, EINA_TRUE);
79                 }
80                 virtual void OnSKeyUp(int id, Evas *e, Evas_Object *obj, Evas_Event_SKey_Up *ev) {
81                         _DBG();
82                         if (m->eoBtnOpen == obj) {
83                                 _DBG();
84                                 if (ev->skey == SKEY_ENTER)
85                                         return;
86
87                                 CViewMgr::GetInstance()->UpdateView(FBR_BASE_VIEW, NULL);
88                         }
89                         else {
90                                 _DBG();
91                                 if (ev->skey == SKEY_ENTER)
92                                         return;
93
94                                 elm_object_signal_emit(obj, FBR_SIGNAL_CONTENT_CLICKED, FBR_CONTEXT_VIEW);
95                         }
96                 }
97                 virtual void OnMouseUp(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Up *ev) {
98                         _DBG();
99                         if (m->eoBtnOpen == obj) {
100                                 CViewMgr::GetInstance()->UpdateView(FBR_BASE_VIEW, NULL);
101                         }
102                         else {
103                                 elm_object_signal_emit(obj, FBR_SIGNAL_CONTENT_CLICKED, FBR_CONTEXT_VIEW);
104                         }
105                 }
106         } *pHandlerButton;
107 };
108
109
110 extern const char *typestr[];
111
112
113 void CContextView::_lbl_start_slide(Evas_Object *lbl)
114 {
115         elm_label_ellipsis_set(lbl, EINA_FALSE);
116         elm_label_slide_mode_set(lbl, ELM_LABEL_SLIDE_MODE_AUTO);
117         elm_label_slide_go(lbl);
118 }
119
120 void CContextView::_btn_focused(void *data, Evas_Object *obj, void *ev)
121 {
122         _DBG();
123         if (!obj)
124                 return;
125
126         elm_object_signal_emit(obj, FBR_SIGNAL_FOCUSED, FBR_CONTEXT_VIEW);
127
128 }
129
130 void CContextView::_btn_unfocused(void *data, Evas_Object *obj, void *ev)
131 {
132         _DBG();
133         if (!obj)
134                 return;
135
136         elm_object_signal_emit(obj, FBR_SIGNAL_UNFOCUSED, FBR_CONTEXT_VIEW);
137 }
138
139
140 bool CContextView::_add_btn_label(Evas_Object *btn, const char *txt)
141 {
142         Evas_Object *lbl;
143         char buf[MAX_LENGTH];
144
145         if (!btn || !txt)
146                 return false;
147
148         lbl = elm_label_add(btn);
149         if (!lbl) {
150                 _ERR("elm_label_add failed.");
151                 return false;
152         }
153
154         snprintf(buf, sizeof(buf),
155                         "<align=center><color=#FFFFFFFF>"
156                         "<font=%s>"
157                         "<font_size=21>%s</font_size>"
158                         "</font></color></align>", FONT_STYLE_MEDIUM, _(txt));
159         elm_object_text_set(lbl, buf);
160         elm_label_line_wrap_set(lbl, ELM_WRAP_WORD);
161         evas_object_size_hint_min_set(lbl, MIN_LABEL_WIDTH, 0);
162         elm_object_part_content_set(btn, FBR_PART_CTXT_BTNTEXT, lbl);
163
164         return true;
165 }
166
167 bool CContextView::_add_btn_icon(Evas_Object *btn, const char *icon)
168 {
169         Evas_Object *img;
170         char buf[MAX_LENGTH];
171
172         if (!btn || !icon)
173                 return false;
174
175         img = elm_image_add(btn);
176         if (!img) {
177                 _ERR("elm_image_add failed.");
178                 return false;
179         }
180
181         snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR, icon);
182         elm_image_file_set(img, buf, NULL);
183         elm_object_part_content_set(btn, FBR_PART_CTXT_BTNICON, img);
184
185         return true;
186 }
187
188 bool CContextView::_add_btn_info(Evas_Object *btn, const char *icon, const char *txt)
189 {
190         if (!btn || !icon || !txt)
191                 return false;
192
193         if (!_add_btn_icon(btn, icon))
194                 return false;
195
196         if (!_add_btn_label(btn, txt))
197                 return false;
198
199         return true;
200 }
201
202
203 Evas_Object *CContextView::_add_btnbox(Evas_Object *eoBase)
204 {
205         Evas_Object *box;
206
207         if (!eoBase)
208                 return NULL;
209
210         box = elm_box_add(eoBase);
211         if (!box) {
212                 _ERR(" elm_box_add failed ");
213                 return NULL;
214         }
215
216         elm_box_horizontal_set(box, EINA_TRUE);
217         elm_box_padding_set(box, FBR_CTXT_BTN_WPAD, 0);
218         elm_box_align_set(box, 0, 0.5);
219         evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND,
220                         EVAS_HINT_EXPAND);
221
222         return box;
223 }
224
225 bool CContextView::_get_context_details(CExtNameInfo *pInfo, char **path, char **title, char *subtitle, char *subtitle2)
226 {
227         char buf[MAX_LENGTH];
228         TSize size;
229         double size_mb;
230         int type;
231
232         if (!pInfo)
233                 return false;
234
235         *title = pInfo->Name();
236         *path  = pInfo->ThumbnailPath();
237         size = pInfo->Size();
238
239         size_mb = (double)size / (1024 * 1024); /* Convert to MB */
240
241         snprintf(buf, sizeof(buf), "%s : %f MB", _(FBR_TEXT_SIZE), size_mb);
242         strcpy(subtitle, buf);
243
244         type = pInfo->Type();
245         snprintf(buf, sizeof(buf), "%s : %s", _(FBR_TEXT_FORMAT), _(typestr[type]));
246         strcpy(subtitle2, buf);
247
248         return true;
249 }
250
251 Evas_Object *CContextView::_add_rltv_ctnt(Evas_Object *obj, const char *name, const char *icon)
252 {
253         Evas_Object *ly, *img;
254         char buf[MAX_LENGTH];
255
256         if (!obj) {
257                 _ERR("Invalid argument.");
258                 return NULL;
259         }
260
261         ly = elm_layout_add(obj);
262         if (!ly) {
263                 _ERR("elm_layout_add failed.");
264                 return NULL;
265         }
266
267         elm_layout_file_set(ly, EDJEFILE, FBR_CONTEXT_APP);
268         evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
269
270         img = elm_image_add(ly);
271         if (!img) {
272                 _ERR("elm_image_add failed.");
273                 evas_object_del(ly);
274                 return NULL;
275         }
276
277         if (!icon || !strcmp(icon, EMPTY_STR)) {
278                 snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR, FBR_IMAGE_DEFAULT_APP);
279                 elm_image_file_set(img, buf, NULL);
280                 elm_image_no_scale_set(img, EINA_TRUE);
281         } else {
282                 elm_image_file_set(img, icon, NULL);
283                 elm_image_aspect_fixed_set(img, EINA_FALSE);
284         }
285
286         elm_object_part_content_set(ly, FBR_PART_CTXT_RELCTNT_ICON, img);
287         elm_object_part_text_set(ly, FBR_PART_CTXT_RELCTNT_NAME, name);
288         elm_object_focus_allow_set(ly, EINA_TRUE);
289
290         return ly;
291 }
292
293
294 Evas_Object *CContextView::_add_scroller(Evas_Object *eoBase)
295 {
296         Evas_Object *scroller;
297
298         if (!eoBase) {
299                 _ERR("Invalid argument.");
300                 return NULL;
301         }
302
303         scroller = elm_scroller_add(eoBase);
304         if (!scroller) {
305                 _ERR("elm_scroller_add failed.");
306                 return NULL;
307         }
308
309         evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND,
310                         EVAS_HINT_EXPAND);
311         evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL,
312                         EVAS_HINT_FILL);
313
314         return scroller;
315 }
316
317 Evas_Object *CContextView::_add_table(Evas_Object *eoBase)
318 {
319         Evas_Object *table;
320
321         if (!eoBase) {
322                 _ERR("Invalid argument.");
323                 return NULL;
324         }
325
326         table = elm_table_add(eoBase);
327         if (!table) {
328                 _ERR("elm_table_add failed.");
329                 return NULL;
330         }
331
332         elm_table_homogeneous_set(table, EINA_TRUE);
333         elm_table_padding_set(table,
334                         FBR_CTXT_TABLE_WPAD * elm_config_scale_get(),
335                         FBR_CTXT_TABLE_HPAD * elm_config_scale_get());
336         evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
337         evas_object_show(table);
338
339         return table;
340 }
341
342
343 Evas_Object *CContextView::_get_icon(Evas_Object *obj, CExtNameInfo *finfo)
344 {
345         Evas_Object *icon;
346         char *path;
347
348         path = finfo->Path();
349         if (!path)
350                 return NULL;
351
352         icon = elm_icon_add(obj);
353         if (!icon)
354                 return NULL;
355
356         elm_need_ethumb();
357         elm_icon_thumb_set(icon, path, NULL);
358         elm_image_aspect_fixed_set(icon, EINA_FALSE);
359
360         return icon;
361 }
362
363
364 void CContextView::_set_default_thumb(Evas_Object *img, int type)
365 {
366         char buf[MAX_LENGTH];
367
368         if (!img)
369                 return;
370
371         switch (type) {
372         case E_GRP_FOLDER:
373                 snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
374                                 FBR_IMAGE_FOLDER);
375                 break;
376
377         case E_GRP_VIDEO:
378                 snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
379                                 FBR_IMAGE_DEFAULT_VIDEO);
380                 break;
381
382         case E_GRP_MUSIC:
383                 snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
384                                 FBR_IMAGE_DEFAULT_MUSIC);
385                 break;
386
387         default:
388                 snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
389                                 FBR_IMAGE_DEFAULT_OTHER);
390                 break;
391         }
392
393         elm_image_file_set(img, buf, NULL);
394         elm_image_no_scale_set(img, EINA_TRUE);
395 }
396
397
398 Evas_Object *CContextView::_create_lbl(Evas_Object *ly, char *title)
399 {
400         Evas_Object *lbl;
401         const char *s;
402         char buf[MAX_LENGTH];
403
404         if (!title)
405                 return NULL;
406
407         lbl = elm_label_add(ly);
408         if (!lbl) {
409                 return NULL;
410         }
411
412         elm_object_style_set(lbl, FBR_STYLE_LABEL);
413         elm_label_ellipsis_set(lbl, EINA_TRUE);
414         s = edje_object_data_get(elm_layout_edje_get(ly),
415                         FBR_DATA_TITLE_WIDTH);
416         if (s)
417                 elm_label_wrap_width_set(lbl, atoi(s));
418         else
419                 _ERR("No title width exist");
420
421         snprintf(buf, sizeof(buf),
422                         "<align=left><color=#FFFFFFFF>"
423                         "<font=%s>"
424                         "<font_size=36>%s</font_size>"
425                         "</font></color></align>", FONT_STYLE_BOLD, _(title));
426         elm_object_text_set(lbl, buf);
427         elm_label_slide_speed_set(lbl, FBR_TITLE_SLIDE_SPEED);
428
429         return lbl;
430 }
431
432
433
434 void CContextView::m_SetBtnDownFocus(Evas_Object *btn)
435 {
436         ASSERT(m);
437
438         if (!m->link_first[0] && !m->rel_first[0]) {
439                 elm_object_focus_next_object_set(btn, btn,
440                         ELM_FOCUS_DOWN);
441                 return;
442         }
443
444         if (m->link_first[0])
445                 elm_object_focus_next_object_set(btn, m->link_first[0],
446                 ELM_FOCUS_DOWN);
447         else
448                 elm_object_focus_next_object_set(btn, m->rel_first[0],
449                 ELM_FOCUS_DOWN);
450 }
451
452
453 void CContextView::m_SetLayoutFocusOrder(Evas_Object *btn)
454 {
455         ASSERT(btn);
456
457         int i;
458         Evas_Object *obj;
459
460         if (m->link_first[0]) {
461                 elm_object_focus_next_object_set(m->link_first[0], btn,
462                         ELM_FOCUS_UP);
463                 elm_object_focus_next_object_set(m->link_first[0],
464                         m->rel_first[0], ELM_FOCUS_DOWN);
465                 elm_object_focus_next_object_set(m->link_first[1], btn,
466                         ELM_FOCUS_UP);
467                 elm_object_focus_next_object_set(m->link_first[1],
468                         m->rel_first[0], ELM_FOCUS_DOWN);
469         }
470
471         for (i = 0; i < TABLE_MAX_COL; i++) {
472                 if (!m->rel_first[i])
473                         continue;
474
475                 obj = m->rel_first[i];
476                 if (m->link_first[0])
477                         elm_object_focus_next_object_set(obj, m->link_first[0],
478                         ELM_FOCUS_UP);
479                 else
480                         elm_object_focus_next_object_set(obj, btn,
481                         ELM_FOCUS_UP);
482         }
483 }
484
485
486 Evas_Object *CContextView::m_AddButton(Evas_Object *eoBase)
487 {
488         ASSERT(eoBase);
489
490         Evas_Object *btn;
491
492         btn = elm_layout_add(eoBase);
493         if (!btn) {
494                 _ERR("elm_layout_add failed.");
495                 return NULL;
496         }
497
498         evas_object_size_hint_weight_set(btn,
499                 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
500         evas_object_size_hint_align_set(btn, 0.0, 0.5);
501
502         elm_layout_file_set(btn, EDJEFILE, FBR_CONTEXT_BTN);
503         elm_object_focus_allow_set(btn, EINA_TRUE);
504         elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_UP);
505         elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_LEFT);
506         elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_RIGHT);
507
508         evas_object_smart_callback_add(btn, FBR_SIGNAL_FOCUSED,   _btn_focused, NULL);
509         evas_object_smart_callback_add(btn, FBR_SIGNAL_UNFOCUSED, _btn_unfocused, NULL);
510
511         evas_object_show(btn);
512         elm_object_focus_set(btn, EINA_TRUE);
513
514         return btn;
515 }
516
517
518 bool CContextView::m_AddTableContents(Evas_Object *table, Eina_List *list, enum content_app_type type)
519 {
520         ASSERT(list);
521
522         int row, col;
523         Evas_Object *ly;
524         Eina_List *l;
525         CDummyContent::SRelativeContent *rctnt;
526         void* obj;
527
528         row = 0;
529         col = 0;
530
531         EINA_LIST_FOREACH(list, l, obj) {
532                 rctnt = (CDummyContent::SRelativeContent *)obj;
533                 ly = _add_rltv_ctnt(table, rctnt->title, rctnt->imgpath);
534                 if (!ly)
535                         continue;
536                 //_SET_PRIV(ly, rctnt);
537                 elm_table_pack(table, ly, col, row, 1, 1);
538                 evas_object_show(ly);
539
540                 evas_object_smart_callback_add(ly, FBR_SIGNAL_FOCUSED,       _btn_focused, NULL);
541                 evas_object_smart_callback_add(ly, FBR_SIGNAL_UNFOCUSED,     _btn_unfocused, NULL);
542
543                 m->pHandlerButton->Connect(ly);
544
545                 if (row == 0) {
546                         if (type == APP_LINKED)
547                                 m->link_first[col] = ly;
548                         else
549                                 m->rel_first[col] = ly;
550                 }
551
552                 if (col == 0)
553                         elm_object_focus_next_object_set(ly, ly, ELM_FOCUS_LEFT);
554                 else if (col == TABLE_MAX_COL - 1)
555                         elm_object_focus_next_object_set(ly, ly, ELM_FOCUS_RIGHT);
556
557                 if (type == APP_LINKED)
558                         m->link_last[col] = ly;
559                 else
560                         m->rel_last[col] = ly;
561
562                 col++;
563                 if (col >= TABLE_MAX_COL) {
564                         row++;
565                         col = 0;
566                 }
567         }
568
569         return true;
570 }
571
572
573 bool CContextView::m_CreateContentApps(Eina_List *list, enum content_app_type type)
574 {
575         if (!list)
576                 return false;
577
578         Evas_Object *scroller, *table;
579         int r;
580
581         scroller = _add_scroller(Base());
582         if (!scroller) {
583                 _ERR("_add_scroller failed.");
584                 return false;
585         }
586
587         table = _add_table(scroller);
588         if (!table) {
589                 _ERR("_add_table failed.");
590                 evas_object_del(scroller);
591                 return false;
592         }
593
594         r = m_AddTableContents(table, list, type);
595         if (!r) {
596                 _ERR("m_AddTableContents failed.");
597                 evas_object_del(scroller);
598                 return false;
599         }
600
601         elm_object_content_set(scroller, table);
602
603         if (type == APP_LINKED)
604                 elm_object_part_content_set(Base(), FBR_PART_CTXT_LINK_AREA,
605                 scroller);
606         else
607                 elm_object_part_content_set(Base(), FBR_PART_CTXT_REL_AREA,
608                 scroller);
609
610         return true;
611 }
612
613
614 bool CContextView::m_CreateBtnsPart(void)
615 {
616         Evas_Object *btn, *box;
617         box = _add_btnbox(Base());
618         if (!box)
619                 return false;
620
621         btn = m_AddButton(box);
622         if (!btn) {
623                 evas_object_del(box);
624                 return false;
625         }
626         if (!_add_btn_info(btn, FBR_IMAGE_CTXT_OPEN, FBR_TEXT_OPEN)) {
627                 evas_object_del(box);
628                 return false;
629         }
630
631         m_SetBtnDownFocus(btn);
632         m_SetLayoutFocusOrder(btn);
633         elm_box_pack_end(box, btn);
634         m->eoBtnOpen = btn;
635
636         m->pHandlerButton->Connect(m->eoBtnOpen);
637
638         elm_object_part_content_set(Base(), FBR_PART_CTXT_BTNAREA, box);
639
640         return true;
641 }
642
643
644 bool CContextView::m_CreateInfoPart(void)
645 {
646         Evas_Object *img = NULL;
647         char *title = NULL;
648
649         char subtitle[MAX_LENGTH];
650         char subtitle2[MAX_LENGTH];
651
652         char *path = NULL;
653         Eina_List *rltvlist = NULL;
654         Eina_List *linkapplist = NULL;
655         int type;
656         Evas_Object *lbl = NULL;
657
658         if (!_get_context_details(m->finfo, &path, &title, subtitle, subtitle2))
659                 return false;
660
661         type = m->finfo->Type();
662         if (!path) {
663                 if (type == E_GRP_PHOTO) {
664                         img = _get_icon(Base(), m->finfo);
665                         if (!img)
666                                 goto finish;
667                 } else {
668                         img = elm_image_add(Base());
669                         if (!img)
670                                 goto finish;
671                         _set_default_thumb(img, type);
672                 }
673         } else {
674                 img = elm_image_add(Base());
675                 if (!img)
676                         goto finish;
677                 elm_image_file_set(img, path, NULL);
678                 elm_image_aspect_fixed_set(img, EINA_FALSE);
679         }
680
681         elm_object_part_content_set(Base(), FBR_PART_CTXT_ICON, img);
682
683         lbl = _create_lbl(Base(), title);
684         if (lbl) {
685                 elm_object_part_content_set(Base(), FBR_PART_CTXT_TITLE, lbl);
686                 _lbl_start_slide(lbl);
687         }
688
689         elm_object_part_text_set(Base(), FBR_PART_CTXT_SUBTITLE,  subtitle);
690         elm_object_part_text_set(Base(), FBR_PART_CTXT_SUBTITLE2, subtitle2);
691
692         elm_object_part_text_set(Base(), FBR_PART_CTXT_LINK_TEXT, _(FBR_TEXT_LINK));
693         linkapplist = CDummyContent::ListLinkApp(type);
694         if (linkapplist)
695                 m_CreateContentApps(linkapplist, APP_LINKED);
696
697         elm_object_part_text_set(Base(), FBR_PART_CTXT_REL_TEXT, _(FBR_TEXT_REL));
698         rltvlist = CDummyContent::ListRelative(type);
699         if (rltvlist)
700                 m_CreateContentApps(rltvlist, APP_OTHER);
701
702 finish:
703
704         return true;
705 }
706
707
708 void CContextView::sm_CbKeyPressed(void *dt, Evas *e, Evas_Object *obj, void *ei)
709 {
710         _DBG();
711         Evas_Event_Key_Down *ev;
712
713         if (!dt || !ei)
714                 return;
715
716         ev = (Evas_Event_Key_Down *)ei;
717
718         if (!strcmp(ev->keyname, KEY_BACK) || !strcmp(ev->keyname, KEY_BACK_REMOTE))
719         {
720                 CViewMgr::GetInstance()->PopView();
721         }
722         else if (!strcmp(ev->keyname, KEY_EXIT))
723                 elm_exit();
724 }
725
726 void CContextView::t_OnShow(void)
727 {
728         evas_object_show(Base());
729 }
730
731 void CContextView::t_OnHide(void)
732 {
733         evas_object_hide(Base());
734 }
735
736 bool CContextView::Create(void *data, Evas_Object *base)
737 {
738         ASSERT(!m);
739
740         Evas_Object *eoBase = NULL;
741         Evas_Object *eoWin = CViewMgr::GetInstance()->Window();
742
743
744         _CREATE_BEGIN{
745                 _CHECK(m = new SContextView)
746                 _CHECK(eoBase = elm_layout_add(eoWin))
747                 _CHECK(elm_layout_file_set(eoBase, EDJEFILE, FBR_CONTEXT_VIEW))
748                 _COMMAND{ m->eoWin = eoWin; m->finfo = (CExtNameInfo*)data; }
749                 _CHECK(CBaseView::Create(NULL, eoBase))
750                 _CHECK(m_CreateInfoPart())
751                 _CHECK(m_CreateBtnsPart())
752
753                 _WHEN_SUCCESS{
754                         evas_object_event_callback_add(eoBase, EVAS_CALLBACK_KEY_DOWN, sm_CbKeyPressed, m);
755                 }
756
757                 _CHECK_FAIL{ /* m_CreateBtnsPart */ }
758                 _CHECK_FAIL{ /* m_CreateInfoPart */ }
759                 _CHECK_FAIL{ CBaseView::Destroy(); }
760                 _CHECK_FAIL{}
761                 _CHECK_FAIL{ evas_object_del(eoBase);  }
762                 _CHECK_FAIL{ delete m; m = NULL; }
763         } _CREATE_END_AND_CATCH{ return false; }
764
765         return true;
766 }
767
768 void CContextView::Destroy(void)
769 {
770         ASSERT(m);
771
772         evas_object_del(Base());
773
774         CBaseView::Destroy();
775
776         delete m;
777         m = NULL;
778 }