Modification due to the change of CBaseView
[profile/tv/apps/native/musicplayer.git] / include / context-view.h
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 #ifndef __CONTEXT_VIEW_H__
18 #define __CONTEXT_VIEW_H__
19
20 struct SContentInfo;
21 struct SRltvCtnt;
22
23 class CContextView : public CBaseView,
24         public IMouseMoveListener, public IMouseUpListener,
25         public IFocusedListener, public IUnfocusedListener {
26 private:
27         struct SContextView* m;
28
29 private:
30         static void sm_CbRltdCtntSelected(void *data, Evas_Object *obj, const char *emission, const char *source);
31
32         static void sm_CbRemove(void* cookie, CMessagePopup *instance);
33         void m_OnRemove(CMessagePopup *instance);
34
35         static void sm_CbCancel(void* cookie, CMessagePopup *instance);
36         void m_OnCancel(CMessagePopup *instance);
37
38         static int sm_CbSortPlaylist(const void *d1, const void *d2);
39
40         static Eina_Bool sm_CbSelectIdler(void *dt);
41         Eina_Bool m_OnSelectIdler(void);
42
43         static void sm_CbCtxPopupBtnSelected(void* cookie, CContextPopup* instance, const char* text);
44         void m_CbCtxPopupBtnSelected(CContextPopup* instance, const char* text);
45
46
47
48 private:
49         Evas_Object *m_AddScroller(Evas_Object *base);
50         void m_SetBtnDownFocus(Evas_Object *btn);
51         void m_SetLayoutFocusOrder(Evas_Object *btn);
52         void m_SetBtnsFocusOrder(Evas_Object *btn, Evas_Object *prv,
53                 int btnTypeIndex, int btnTypeFirst, int btnTypeLast);
54         bool m_AddBtnLabel(Evas_Object *btn, const char *txt);
55         bool m_AddBtnIcon(Evas_Object *btn, const char *icon);
56         bool m_AddBtnInfo(Evas_Object *btn, const char *icon, const char *txt);
57         Evas_Object *m_AddButton(Evas_Object *base);
58         Evas_Object *m_AddBtnBox(Evas_Object *base);
59         bool m_CreateBtnsPart(void);
60         Eina_List *m_OtherSongsOfArtist(char *artist, char *title);
61         Eina_List *m_OtherAlbumsOfArtist(char *artist, char *album);
62         Eina_List *m_OtherSimilarArtist(char *artist);
63         Eina_List *m_OtherSongsOfGenre(char *genre);
64         SRltvCtnt *m_InfoOfAlbum(char *album);
65         SRltvCtnt *m_InfoOfArtist(char *artist);
66         SRltvCtnt *m_InfoOfGenre(char *genre);
67         bool m_GetContextDetails(SContentInfo *cinfo, char **path,
68                 char **title, char **subtitle, char **subtitle2,
69                 char **rltvtitle, SRltvCtnt **ctntinfo,
70                 Eina_List **rltvlist);
71         Evas_Object *m_AddRltvCtnt(Evas_Object *obj, char *name, char *icon);
72         bool m_AddTableContents(Eina_List *list);
73         Evas_Object *m_AddTable(Evas_Object *base);
74         bool m_CreateRltvContent(Eina_List *list);
75         bool m_CreateMoreinfoLayout(SRltvCtnt *rctnt, Evas_Object *img);
76         bool m_CreateInfoPart(void);
77         bool m_CreateFullView(void);
78         CContextPopup *m_CreatePlaylistPopup(void);
79         CMessagePopup *m_CreateRemovePopup(Evas_Object *base, const char *msg);
80         void m_DestroyPopup(void);
81         void m_HandleBtnSelected(int btnType);
82         void m_HandleMoreinfoSelected(Evas_Object *obj);
83
84 protected:
85         virtual void t_OnShow(void);
86         virtual void t_OnHide(void);
87         virtual void t_OnUpdate(void* data);
88
89 public:
90         CContextView(const char *pViewId) :
91                 CBaseView(pViewId),
92                 IMouseMoveListener(this),
93                 IMouseUpListener(this),
94                 IFocusedListener(this),
95                 IUnfocusedListener(this),
96                 m(0) {}
97         virtual ~CContextView() {}
98
99         virtual bool Create(void *data, Evas_Object *eoBase);
100         virtual void Destroy(void);
101
102 public:
103         virtual void OnSKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_SKey_Down *ev);
104         virtual void OnSKeyUp(int id, Evas *e, Evas_Object *obj, Evas_Event_SKey_Up *ev);
105         virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev);
106         virtual void OnMouseUp(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Up *ev);
107         virtual void OnFocused(int id, Evas_Object *obj, Elm_Object_Item *item);
108         virtual void OnUnfocused(int id, Evas_Object *obj, Elm_Object_Item *item);
109 };
110
111
112 #endif /*__CONTEXT_VIEW_H__*/