Remove dependency from CPlaybackView to CPlaybackController.
[profile/tv/apps/native/musicplayer.git] / src / views / PlaybackController.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 __PLAYBACK_CONTROLLER_H__
18 #define __PLAYBACK_CONTROLLER_H__
19
20 class CPlaybackController :
21         public CListenerMgr,
22         public IMusicControllerListener,
23         public IPressedListener,
24         public IUnpressedListener,
25         public IMouseMoveListener,
26         public IMouseClickedListener {
27 public:
28         struct SCallback {
29                 void *cookie;
30                 int(*OnCurrentSongCount)(void *cookie);
31         };
32
33 private:
34         struct SPlaybackController *m;
35
36 private:
37         static void sm_CbCtxPopupBtnSelected(void* cookie, CContextPopup* instance, const char* text);
38         void m_OnCtxPopupBtnSelected(CContextPopup* instance, const char* text);
39
40         static void sm_CbErrorPopupBtnSelected(void* cookie, CMessagePopup *instance);
41         void m_OnErrorPopupBtnSelected(CMessagePopup *instance);
42
43         static Eina_Bool sm_CbWaitTimer(void *dt);
44         void m_OnWaitTimer(void);
45
46         static Eina_Bool sm_CbLongpressTimer(void *dt);
47         void m_OnLongpressTimer(void);
48
49 private:
50         void m_AddControlButtons(void);
51         void m_AddEditPlaylistButtons(void);
52         void m_CreateErrorPopup(void);
53         void m_DestroyErrorPopup(void);
54         void m_CreateSettingsPopup(void);
55         void m_DestroySettingsPopup(void);
56         void m_UpdateForEmptySong(void);
57
58         void m_HandleForwardBtnClicked(Evas_Object *obj);
59         void m_HandleRewindBtnClicked(Evas_Object *obj);
60         void m_HandleOnRepeated(void);
61         void m_HandleOnPressed(Evas_Object *obj);
62         void m_HandleOnUnpressed(Evas_Object *obj);
63
64         void m_RemoveTimer(int timer_code);
65         void m_UpdateSongInfo(void);
66
67         void m_Update(void);
68
69 public:
70         CPlaybackController() :
71                 IPressedListener(this),
72                 IUnpressedListener(this),
73                 IMouseMoveListener(this),
74                 IMouseClickedListener(this),
75                 m(0) {}
76         virtual ~CPlaybackController() {}
77
78         bool Create(Evas_Object *eoBase, SCallback *cb);
79         virtual void Destroy(void);
80
81         Evas_Object *ControlBtnsObject(EPlayerControlBtns id);
82         Evas_Object *EditBtnsObject(EPlayerEditBtns id);
83
84 public:
85         //! This function is invoked when new song is played.
86         virtual void OnStartPlayback(void);
87         //! This function is invoked when error is occured.
88         virtual void OnError(void);
89         //! This function is invoked when playlist is empty.
90         virtual void OnEmptyPlaylist(void);
91         //! This function is invoked when remote button is pressed.
92         virtual void OnRemoteButtonEvent(Evas_Object *eoBtn, EPlayerBtnsEvent ev);
93         //! This function is invoked when player UI need to be updated.
94         virtual void OnUpdatePlayerUI(void);
95
96         virtual void OnPressed(int id, Evas_Object *obj);
97         virtual void OnUnpressed(int id, Evas_Object *obj);
98         virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev);
99         virtual void OnMouseClicked(int id, Evas_Object *obj);
100 };
101
102 #endif // __PLAYBACK_CONTROLLER_H__