1. Apply the new sort module to CSongLayout.
[profile/tv/apps/native/musicplayer.git] / include / song-layout.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 __SONG_LAYOUT_H__
18 #define __SONG_LAYOUT_H__
19
20
21 struct SSongItemInfo;
22
23 class CSongLayout : public CExtBaseLayout, public CListenerMgr,
24         public IKeyDownListener, public IMouseMoveListener {
25 private:
26         struct SSongLayout *m;
27
28 private:
29         static char *sm_CbGetListItemText(void *data, Evas_Object *obj, const char *part);
30         static Evas_Object *sm_CbGetListItemContent(void *data, Evas_Object *obj, const char *part);
31         static void sm_CbRemoveListItem(void *data, Evas_Object *obj);
32         static void sm_CbGenlistKeyDown(void *dt, Evas *e, Evas_Object *obj, void *ei);
33
34         static void sm_CbCtxtUpdate(void *dt, enum EActionType type, int lid);
35         void m_OnCtxtUpdate(EActionType type, int lid);
36
37         static void sm_CbCtxtClose(void *dt);
38         void m_OnCtxtClose(void);
39
40         static void sm_CbItemSelect(void *data, Evas_Object *obj, void *event_info);
41         void m_OnItemSelect(Evas_Object *obj, void *event_info);
42
43         static int sm_CbSortArtistAZ(const void *d1, const void *d2);
44         static int sm_CbSortArtistZA(const void *d1, const void *d2);
45         static int sm_CbSortAlbumAZ(const void *d1, const void *d2);
46         static int sm_CbSortAlbumZA(const void *d1, const void *d2);
47
48 private:
49         SSongItemInfo *m_FindItemInfoFromItem(Eina_List *list, Elm_Object_Item *item);
50         void m_UpdateSongList(bool sort_flag);
51         void m_SortSongList(void);
52         void m_EmptySongList(bool sort_flag);
53         void m_GotoPlayback(void);
54         void m_GotoPlaybackUri(void);
55         void m_CreateSongList(void);
56
57 protected:
58         virtual void t_OnShow(void);
59
60 public:
61         CSongLayout(const char *pLayoutId) :
62                 CExtBaseLayout(pLayoutId),
63                 IKeyDownListener(this),
64                 IMouseMoveListener(this),
65                 m(0) {}
66         virtual ~CSongLayout() {}
67
68         bool Create(CLayoutMgr *mgr, const char *uri);
69         virtual void Destroy(void);
70
71         virtual void Update(bool focusFlag);
72
73 public:
74         virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
75         virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev);
76 };
77
78
79 #endif /*__SONG_LAYOUT_H__*/