4311468e8964c47989fdd52e689555fac9e2e3ab
[vuplus_xbmc] / xbmc / pvr / windows / GUIWindowPVRGuide.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2012-2013 Team XBMC
5  *      http://xbmc.org
6  *
7  *  This Program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  This Program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with XBMC; see the file COPYING.  If not, see
19  *  <http://www.gnu.org/licenses/>.
20  *
21  */
22
23 #include "GUIWindowPVRCommon.h"
24 #include "epg/GUIEPGGridContainer.h"
25 #include "threads/CriticalSection.h"
26 #include "utils/Observer.h"
27 #include "../channels/PVRChannelGroup.h"
28
29 class CSetting;
30
31 namespace PVR
32 {
33   enum EpgGuideView
34   {
35     GUIDE_VIEW_CHANNEL  = 0,
36     GUIDE_VIEW_NOW,
37     GUIDE_VIEW_NEXT,
38     GUIDE_VIEW_TIMELINE
39   };
40
41   class CGUIWindowPVR;
42
43   class CGUIWindowPVRGuide : public CGUIWindowPVRCommon, public Observer
44   {
45     friend class CGUIWindowPVR;
46
47   public:
48     CGUIWindowPVRGuide(CGUIWindowPVR *parent);
49     virtual ~CGUIWindowPVRGuide(void);
50
51     void GetContextButtons(int itemNumber, CContextButtons &buttons) const;
52     bool OnContextButton(int itemNumber, CONTEXT_BUTTON button);
53     void UpdateData(bool bUpdateSelectedFile = true);
54     void Notify(const Observable &obs, const ObservableMessage msg);
55     void SetInvalid(void) { UpdateData(); }
56     void UnregisterObservers(void);
57     void ResetObservers(void);
58     
59     static void SettingOptionsEpgGuideViewFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int &current);
60
61   private:
62     bool SelectPlayingFile(void);
63     bool IsSelectedButton(CGUIMessage &message) const;
64     bool IsSelectedList(CGUIMessage &message) const;
65     bool OnClickButton(CGUIMessage &message);
66     bool OnClickList(CGUIMessage &message);
67     bool PlayEpgItem(CFileItem *item);
68
69     bool OnContextButtonBegin(CFileItem *item, CONTEXT_BUTTON button);
70     bool OnContextButtonEnd(CFileItem *item, CONTEXT_BUTTON button);
71     bool OnContextButtonNow(CFileItem *item, CONTEXT_BUTTON button);
72     bool OnContextButtonInfo(CFileItem *item, CONTEXT_BUTTON button);
73     bool OnContextButtonPlay(CFileItem *item, CONTEXT_BUTTON button);
74     bool OnContextButtonStartRecord(CFileItem *item, CONTEXT_BUTTON button);
75     bool OnContextButtonStopRecord(CFileItem *item, CONTEXT_BUTTON button);
76
77     void UpdateButtons(void);
78     void UpdateViewChannel(bool bUpdateSelectedFile);
79     void UpdateViewNow(bool bUpdateSelectedFile);
80     void UpdateViewNext(bool bUpdateSelectedFile);
81     void UpdateViewTimeline(bool bUpdateSelectedFile);
82
83     int               m_iGuideView;
84     CFileItemList    *m_cachedTimeline;
85     CPVRChannelGroupPtr m_cachedChannelGroup;
86   };
87 }