]> git.vomp.tv Git - vompclient.git/blob - vepg.h
Change ChannelList back to std::vector, use custom deleter in shared_ptr
[vompclient.git] / vepg.h
1 /*
2     Copyright 2005 Brian Walton
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
18 */
19
20 #ifndef VEPG_H
21 #define VEPG_H
22
23 #include <vector>
24 #include <memory>
25
26 #include "boxx.h"
27 #include "messagequeue.h"
28 #include "defines.h"
29 #include "timers.h"
30 #include "wtextbox.h"
31 #include "vdr.h"
32 #include "wselectlist.h"
33 #include "event.h"
34
35 class VVideoLive;
36 class BoxStack;
37
38 //#define WINDOW_WIDTH (150)
39 #define MINUTE_SCALE (3)
40
41 class VVideoLive;
42
43 class VEpg : public Boxx, public MessageReceiver, public TimerReceiver
44 {
45   public:
46     VEpg(MessageReceiver* parent, UINT currentChannel, std::shared_ptr<ChannelList> tchanList);
47     ~VEpg();
48     static VEpg* getInstance();
49
50     void preDelete();
51     int handleCommand(int command); // deal with commands (from remote control)
52     void draw(); // draw epg view
53     void processMessage(Message* m);
54     void timercall(int clientReference);
55
56   private:
57     static VEpg* instance;
58
59     void setInfo(Event* event); // display details of selected programme
60     void drawgrid(); // redraws grid and select programme
61     void drawData();
62     void setCurrentChannel();
63
64     WSelectList chanListbox; // listbox to display available channels
65     WTextbox progTitle; // area to display time and title of selected programme
66     WTextbox progInfo; // area to display details of selected programme
67     EventList* eventList; // list of events (programmes) for a channel
68     Event thisEvent; // the selected event
69     time_t selTime; // current selection time
70     UINT e; // temp used to point to an event
71     std::shared_ptr<ChannelList> chanList; // list of available channels
72     tm* epgtime; // selected time within epg
73     tm* Ltime; // time of LHS of epg view
74     time_t ltime; // time of LHS of epg view
75     time_t lastEnd; // end time of last painted cell - used to look for gaps in epg
76     WTextbox chanName;
77     std::vector<EventList*> eventLista;
78     int listTop;
79     int listWindowSize;
80     void updateChanList();
81     void updateEventList();
82     void paintCell(Event* event, int yOffset, const DrawStyle& bg, const DrawStyle& fg);
83     time_t prevHour(time_t* t);
84     MessageReceiver* parent;
85     BoxStack* boxstack;
86     UINT gridRows;
87     UINT currentChannelIndex;
88     UINT window_width;
89     UINT window_x;
90 };
91
92 #endif