[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / pvr / windows / GUIWindowPVRCommon.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2012-2013 Team XBMC
5  *      http://www.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 "FileItem.h"
24 #include "windows/GUIMediaWindow.h"
25 #include "GUIWindowPVRCommon.h"
26 #include "threads/CriticalSection.h"
27
28 namespace PVR
29 {
30   enum PVRWindow
31   {
32     PVR_WINDOW_UNKNOWN         = 0,
33     PVR_WINDOW_EPG             = 1,
34     PVR_WINDOW_CHANNELS_TV     = 2,
35     PVR_WINDOW_CHANNELS_RADIO  = 3,
36     PVR_WINDOW_RECORDINGS      = 4,
37     PVR_WINDOW_TIMERS          = 5,
38     PVR_WINDOW_SEARCH          = 6
39   };
40
41   #define CONTROL_LIST_TIMELINE        10
42   #define CONTROL_LIST_CHANNELS_TV     11
43   #define CONTROL_LIST_CHANNELS_RADIO  12
44   #define CONTROL_LIST_RECORDINGS      13
45   #define CONTROL_LIST_TIMERS          14
46   #define CONTROL_LIST_GUIDE_CHANNEL   15
47   #define CONTROL_LIST_GUIDE_NOW_NEXT  16
48   #define CONTROL_LIST_SEARCH          17
49
50   #define CONTROL_LABELHEADER          29
51   #define CONTROL_LABELGROUP           30
52
53   #define CONTROL_BTNGUIDE             31
54   #define CONTROL_BTNCHANNELS_TV       32
55   #define CONTROL_BTNCHANNELS_RADIO    33
56   #define CONTROL_BTNRECORDINGS        34
57   #define CONTROL_BTNTIMERS            35
58   #define CONTROL_BTNSEARCH            36
59   #define CONTROL_BTNGUIDE_CHANNEL     37
60   #define CONTROL_BTNGUIDE_NOW         38
61   #define CONTROL_BTNGUIDE_NEXT        39
62   #define CONTROL_BTNGUIDE_TIMELINE    40
63
64   class CGUIWindowPVR;
65
66   class CGUIWindowPVRCommon
67   {
68     friend class CGUIWindowPVR;
69
70   public:
71     CGUIWindowPVRCommon(CGUIWindowPVR *parent, PVRWindow window,
72         unsigned int iControlButton, unsigned int iControlList);
73     virtual ~CGUIWindowPVRCommon(void) {};
74
75     bool operator ==(const CGUIWindowPVRCommon &right) const;
76     bool operator !=(const CGUIWindowPVRCommon &right) const;
77
78     virtual const char *GetName(void) const;
79     virtual PVRWindow GetWindowId(void) const { return m_window; }
80     virtual bool IsFocused(void) const;
81     virtual bool IsVisible(void) const;
82     virtual bool IsActive(void) const;
83     virtual bool IsSavedView(void) const;
84     virtual bool IsSelectedButton(CGUIMessage &message) const;
85     virtual bool IsSelectedControl(CGUIMessage &message) const;
86     virtual bool IsSelectedList(CGUIMessage &message) const;
87
88     virtual bool OnAction(const CAction &action);
89     virtual bool OnContextButton(int itemNumber, CONTEXT_BUTTON button);
90
91     virtual void GetContextButtons(int itemNumber, CContextButtons &buttons) const = 0;
92     virtual void UpdateData(bool bUpdateSelectedFile = true) = 0;
93     virtual void SetInvalid(void);
94
95     virtual void OnInitWindow(void);
96     virtual void OnWindowUnload(void);
97
98   protected:
99     virtual bool SelectPlayingFile(void);
100     virtual bool OnMessageFocus(CGUIMessage &message);
101
102     virtual bool OnClickButton(CGUIMessage &message) = 0;
103     virtual bool OnClickList(CGUIMessage &message) = 0;
104
105     virtual bool ActionDeleteTimer(CFileItem *item);
106     virtual bool ActionShowTimer(CFileItem *item);
107     virtual bool ActionRecord(CFileItem *item);
108     virtual bool ActionDeleteRecording(CFileItem *item);
109     virtual bool ActionPlayChannel(CFileItem *item);
110     virtual bool ActionPlayEpg(CFileItem *item);
111     virtual bool ActionDeleteChannel(CFileItem *item);
112
113     virtual bool PlayRecording(CFileItem *item, bool bPlayMinimized = false);
114     virtual bool PlayFile(CFileItem *item, bool bPlayMinimized = false);
115     virtual bool StartRecordFile(CFileItem *item);
116     virtual bool StopRecordFile(CFileItem *item);
117     virtual void ShowEPGInfo(CFileItem *item);
118     virtual void ShowRecordingInfo(CFileItem *item);
119     virtual bool UpdateEpgForChannel(CFileItem *item);
120     virtual bool ShowTimerSettings(CFileItem *item);
121     virtual bool ShowNewTimerDialog(void);
122     virtual void ShowBusyItem(void);
123
124     virtual bool OnContextButtonMenuHooks(CFileItem *item, CONTEXT_BUTTON button);
125     virtual bool OnContextButtonSortAsc(CFileItem *item, CONTEXT_BUTTON button);
126     virtual bool OnContextButtonSortBy(CFileItem *item, CONTEXT_BUTTON button);
127     virtual bool OnContextButtonSortByDate(CFileItem *item, CONTEXT_BUTTON button);
128     virtual bool OnContextButtonSortByName(CFileItem *item, CONTEXT_BUTTON button);
129     virtual bool OnContextButtonSortByChannel(CFileItem *item, CONTEXT_BUTTON button);
130     virtual bool OnContextButtonFind(CFileItem *item, CONTEXT_BUTTON button);
131
132     virtual void BeforeUpdate(const CStdString &strDirectory) {}
133     virtual void AfterUpdate(CFileItemList& items) {}
134
135     CGUIWindowPVR *  m_parent;
136     PVRWindow        m_window;
137     unsigned int     m_iControlButton;
138     unsigned int     m_iControlList;
139     bool             m_bUpdateRequired;
140     int              m_iSelected;
141     SortOrder        m_iSortOrder;
142     SORT_METHOD      m_iSortMethod;
143     CCriticalSection m_critSection;
144     CDirectoryHistory m_history;
145   };
146 }