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